'Return the tree as a string for debugging.'

def __str__(self):

    lines = []
    nodes_to_print = collections.deque([collections.deque([('#', self)])])
    while nodes_to_print:
        (indent_str, current_node) = nodes_to_print[(-1)].pop()
        if (not nodes_to_print[(-1)]):
            nodes_to_print.pop()
        if current_node.is_root:
            lines.append(indent_str)
        else:
            lines.append(('%s[%s]' % (indent_str, current_node.process.name())))
        indent_str = ('    ' * (len(lines[(-1)]) - 1))
        children_nodes_to_print = collections.deque()
        for child in current_node.children:
            if (child is current_node.children[(-1)]):
                tree_char = '\xe2\x94\x94\xe2\x94\x80'
            else:
                tree_char = '\xe2\x94\x9c\xe2\x94\x80'
            children_nodes_to_print.appendleft(((indent_str + tree_char), child))
        if children_nodes_to_print:
            nodes_to_print.append(children_nodes_to_print)
    return '\n'.join(lines)
