'Get curses data to display for a process tree.'

def get_process_tree_curses_data(self, node, args, first_level=True, max_node_count=None):

    ret = []
    node_count = 0
    if ((not node.is_root) and ((max_node_count is None) or (max_node_count > 0))):
        node_data = self.get_process_curses_data(node.stats, False, args)
        node_count += 1
        ret.extend(node_data)
    for child in node.iter_children():
        if ((max_node_count is not None) and (node_count >= max_node_count)):
            break
        if (max_node_count is None):
            children_max_node_count = None
        else:
            children_max_node_count = (max_node_count - node_count)
        child_data = self.get_process_tree_curses_data(child, args, first_level=node.is_root, max_node_count=children_max_node_count)
        if (max_node_count is None):
            node_count += len(child)
        else:
            node_count += min(children_max_node_count, len(child))
        if (not node.is_root):
            child_data = self.add_tree_decoration(child_data, (child is node.children[(-1)]), first_level)
        ret.extend(child_data)
    return ret
