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

    data is the return value of rpc_groups()."""
    fmt = '{:<6} {:>9} {:>9} {:>6} {:>6} {:>8}{:>7} {:>9} {:>7} {:>9}'
    yield fmt.format('ID', 'Sessions', 'Bwidth KB', 'Reqs', 'Txs', 'Subs',
        'Recv', 'Recv KB', 'Sent', 'Sent KB')
    for id_, session_count, bandwidth, reqs, txs_sent, subs, recv_count, recv_size, send_count, send_size in data:
        yield fmt.format(id_, '{:,d}'.format(session_count), '{:,d}'.format
            (bandwidth // 1024), '{:,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))
