def in_loop(node):
    'return True if the node is inside a kind of for loop'
    parent = node.parent
    while (parent is not None):
        if isinstance(parent, (astroid.For, astroid.ListComp, astroid.SetComp, astroid.DictComp, astroid.GeneratorExp)):
            return True
        parent = parent.parent
    return False
return True if the node is inside a kind of for loop
def in_loop(node):
    
    parent = node.parent
    while (parent is not None):
        if isinstance(parent, (astroid.For, astroid.ListComp, astroid.SetComp, astroid.DictComp, astroid.GeneratorExp)):
            return True
        parent = parent.parent
    return False