https://weshallneversurrender.com/PyCode-GetFreevars/
Understanding PyCode_GetFreevars in Python: A Detailed Guide