def get_top_level_ancestor(node):
    """
    Traverses the passage upwards until a unit which is immediately below the root is reached
    :param node:
    :return:
    """
    if not node.fparent:
        return node
    parent = node
    while parent.fparent.fparent:
        parent = parent.fparent
    return parent
