This is a copy of the excellent repository https://github.com/davemcewan/svdata, but ported for use in python instead of serializing.
pip install python-svdata
To parse a systemverilog file simply import the function read_sv_file
and specify the path to the file.
from python_svdata import read_sv_file
sv_data = read_sv_file("test.sv")