def build_plugin_tree(plugins):
    cache = dict((p.pk, p) for p in plugins)
    by_parent_id = attrgetter('parent_id')
    nonroots = sorted(filter(by_parent_id, cache.values()),
                      key=attrgetter('parent_id', 'position'))
    families = ((cache[parent_id], tuple(children))
                for parent_id, children
                in groupby(nonroots, by_parent_id))
    for parent, children in families:
        parent.child_plugin_instances = children
    return sorted(filterfalse(by_parent_id, cache.values()),
                  key=attrgetter('position'))
Returns formatted memory size.
dataset/ETHPy150Open divio/django-cms/cms/utils/plugins.py/build_plugin_tree--crossover with--dataset/ETHPy150Open openlmi/openlmi-scripts/commands/system/lmi/scripts/system/__init__.py/format_memory_size