def groups_lines(data):
    """A generator returning lines for a list of groups.

    data is the return value of rpc_groups()."""
    fmt = '{:<14} {:>9} {:>8} {:>8} {:>6} {:>6} {:>8}{:>7} {:>9} {:>7} {:>9}'
    yield fmt.format('Name', 'Sessions', 'Cost', 'Retained', 'Reqs', 'Txs',
        'Subs', 'Recv', 'Recv KB', 'Sent', 'Sent KB')
    for name, session_count, cost, retained_cost, reqs, txs_sent, subs, recv_count, recv_size, send_count, send_size in data:
        yield fmt.format(name, '{:,d}'.format(session_count), '{:,d}'.
            format(int(cost)), '{:,d}'.format(int(retained_cost)), '{:,d}'.
            format(reqs), '{:,d}'.format(txs_sent), '{:,d}'.format(subs),
            '{:,d}'.format(recv_count), '{:,d}'.format(recv_size // 1024),
            '{:,d}'.format(send_count), '{:,d}'.format(send_size // 1024))
