def _prepare_output(partitions, verbose):
    """Returns dict with 'raw' and 'message' keys filled."""
    out = {}
    partitions_count = len(partitions)
    out['raw'] = {
        'offline_count': partitions_count,
    }

    if partitions_count == 0:
        out['message'] = 'No offline partitions.'
    else:
        out['message'] = "{count} offline partitions.".format(count=partitions_count)
        if verbose:
            lines = (
                '{}:{}'.format(topic, partition)
                for (topic, partition) in partitions
            )
            out['verbose'] = "Partitions:\n" + "\n".join(lines)
        else:
            cmdline = sys.argv[:]
            cmdline.insert(1, '-v')
            out['message'] += '\nTo see all offline partitions run: ' + ' '.join(cmdline)

    if verbose:
        out['raw']['partitions'] = [
            {'topic': topic, 'partition': partition}
            for (topic, partition) in partitions
        ]

    return out
Returns dict with 'raw' and 'message' keys filled.