def _system_tree_dict(system, size_1=True, expand_level=9999):

    def _tree_dict(ss, level):
        dct = { 'name': ss.name }
        children = [_tree_dict(s, level+1) for s in ss.subsystems()]

        if isinstance(ss, Component):
            for vname, meta in ss.unknowns.items():
                size = meta['size'] if meta['size'] and not size_1 else 1
                children.append({'name': vname, 'size': size })

            for vname, meta in ss.params.items():
                size = meta['size'] if meta['size'] and not size_1 else 1
                children.append({'name': vname, 'size': size })

        if level > expand_level:
            dct['_children'] = children
            dct['children'] = None
        else:
            dct['children'] = children
            dct['_children'] = None

        return dct

    tree = _tree_dict(system, 1)
    if not tree['name']:
        tree['name'] = 'root'

    return tree
Called whenever a new line is found.
dataset/ETHPy150Open OpenMDAO/OpenMDAO/openmdao/devtools/d3graph.py/_system_tree_dict--crossover with--dataset/ETHPy150Open mopidy/mopidy/mopidy/internal/network.py/LineProtocol.on_line_received