def METHOD_NAME(tree, node):
    predecessors = tree.predecessors(node)
    try:
        parent = next(predecessors)
    except StopIteration:
        return [node]
    try:
        next(predecessors)
        raise RuntimeError()
    except StopIteration:
        pass
    return METHOD_NAME(tree, parent) + [node]