def get_path(leaf):
    """Gets the path from leaf to root in order root -> leaf"""
    if leaf.parent_action is None:  # if we're already at the root, just return empty list (otherwise we'll return [[]])
        return []
    action_sequence = []
    current_node = leaf
    while current_node.parent_action is not None:  # while we're not at the root node
        action_sequence += [current_node.parent_action]
        current_node = current_node.parent_action.source
    action_sequence.reverse()  # reverse the order
    return [action_sequence]