def _count_apps(group, group_dict):

    for child_group in group['groups']:
        _count_apps(child_group, group_dict)

    count = (len(group['apps']) +
             sum(group_dict[child_group['id']][1]
                 for child_group in group['groups']))

    group_dict[group['id']] = (group, count)
Counts how many apps are registered for each group.  Recursively
dataset/ETHPy150Open dcos/dcos-cli/cli/dcoscli/tables.py/_count_apps