from functools import reduce


def subtree_exists(tree, subtree_node_name):
    """
    Checks to see if a subtree or node exists within a parsed tree
    """
    try:
        tree.node
    except AttributeError:
        return tree[1] == subtree_node_name
    else:
        return tree.node == subtree_node_name or reduce(lambda a, b: a or b, [subtree_exists(child, subtree_node_name) for child in tree])