def print_grouping(attributes, grouping):
    table = PrettyTable(attributes + ['count', '%'])
    table.align = 'l'
    table.align['count'] = 'r'
    table.align['%'] = 'r'
    table.float_format['%'] = '.1'

    total = sum(grouping.values())

    for keys, count in grouping.items():
        table.add_row(keys + (count, count * 100.0 / total))

    print '\n', table.get_string(sortby='count', reversesort=True)
    print 'Total:', total
Print computed groups.
dataset/ETHPy150Open operasoftware/sentrycli/sentrycli/group.py/print_grouping