<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def format_tree(tree):
 """Format a python tree structure Given the python tree:: tree = { 'node': ['ROOT', 'This is the root of the tree'], 'childs': [{ 'node': 'A1', 'childs': [{ 'node': 'B1', 'childs': [{ 'node': 'C1' }] }, { 'node': 'B2' }] }, { 'node': 'A2', 'childs': [{ 'node': 'B3', 'childs': [{ 'node': ['C2', 'This is a leaf'] }, { 'node': 'C3' }] }] }, { 'node': ['A3', 'This is a node'], 'childs': [{ 'node': 'B2' }] }] } `format_tree` will return:: ROOT This is the root of the tree ├── A1 │ ├── B1 │ │ └── C1 │ └── B2 ├── A2 │ └── B3 │ ├── C2 This is a leaf │ └── C3 └── A3 This is a node └── B2 """


    def _traverse_tree(tree, parents=None):
        tree['parents'] = parents
        childs = tree.get('childs', [])
        nb_childs = len(childs)
        for index, child in enumerate(childs):
            child_parents = list(parents) + [index == nb_childs - 1]
            tree['childs'][index] = _traverse_tree(
                tree['childs'][index],
                parents=child_parents)
        return tree

    tree = _traverse_tree(tree, parents=[])

    def _get_rows_data(tree, rows):
        prefix = ''
        for p in tree['parents'][:-1]:
            if p is False:
                prefix += '│   '
            else:
                prefix += '    '
        if not tree['parents']:
            pass
        elif tree['parents'][-1] is True:
            prefix += '└── '
        else:
            prefix += '├── '
        if isinstance(tree['node'], string_types):
            tree['node'] = [tree['node']]
        rows.append([prefix + tree['node'][0]] + tree['node'][1:])
        for child in tree.get('childs', []):
            rows = _get_rows_data(child, rows)
        return rows

    rows = _get_rows_data(tree, [])
    return format_table(rows)