human
Complete this python program:
def _clean_parse_tree(tree):
assistant
#Here is the Python code you requested.

    """The parse tree contains a lot of redundant
    nodes. E.g. paren_groups have groups as children, etc. This will
    clean up the tree.
    """
    def unparse_number(n):
        '    Go    from    a    number    parse    tree    to    a    number    '
        if (len(n) == 1):
            rv = n[0][0]
        else:
            rv = (n[0][0] + unparse_number(n[1]))
        return rv
    def null_tag(n):
        '    Remove    a    tag    '
        return n[0]
    def ion_suffix(n):
        '1.    "if"    part    handles    special    case\n                                            2.    "else"    part    is    general    behaviour    '
        if ((n[1:][0].node == 'number') and (n[1:][0][0][0] == '1')):
            return nltk.tree.Tree(n.node, n[2:])
        else:
            return nltk.tree.Tree(n.node, n[1:])
    dispatch = {'number': (lambda x: nltk.tree.Tree('number', [unparse_number(x)])), 'unphased': null_tag, 'unsuffixed': null_tag, 'number_suffix': (lambda x: nltk.tree.Tree('number_suffix', [unparse_number(x[0])])), 'suffixed': (lambda x: (((len(x) > 1) and x) or x[0])), 'ion_suffix': ion_suffix, 'paren_group_square': (lambda x: nltk.tree.Tree(x.node, x[1])), 'paren_group_round': (lambda x: nltk.tree.Tree(x.node, x[1]))}
    if isinstance(tree, str):
        return tree
    old_node = None
    while ((tree.node in dispatch) and (tree.node != old_node)):
        old_node = tree.node
        tree = dispatch[tree.node](tree)
    children = []
    for child in tree:
        child = _clean_parse_tree(child)
        children.append(child)
    tree = nltk.tree.Tree(tree.node, children)
    return tree