def get_import_context(node):
    """
    Go backs up the graph to the import that started this possible cycle,
    and gets the import line number
    :param node:
    :return: int
    """
    name = node.name
    seen = set()
    while node.parent and node.parent.parent:
        node = node.parent
        if node in seen or node.parent and node.parent.name == name:
            break
        seen.add(node)
    return node.is_imported_from[node.parent.full_path][0]
