Parse python code

Hi,
I’m looking for an easy way to parse python code.

class A:
    def get():
        for i in "bl":
             print(i)

class B:
    def get():
        for i in "bl":
             print(i)

what I want at the end is to identify each for loop or get metthod.
the only difference between the 2 for loop and 2 get method sis that they own a different class. How could I know it ?

thanks

This is not clear. What are you trying to input and have as an output?