def main():
    for i in (1, 2):

        def ignorebefore():
            pass
with button():

    def testing(i=i):
        return i

def ignoreafter():
    pass
main()
Finding Functions Defined in a with: Block