def consolidate_stats(dict_of_seqs, stats_key=None, sep='<STR_LIT:U+002C>'):
if isinstance(dict_of_seqs, dict):<EOL><INDENT>stats = dict_of_seqs[stats_key]<EOL>keys = joined_seq(sorted([k for k in dict_of_seqs if k is not stats_key]), sep=None)<EOL>joined_key = joined_seq(keys, sep=sep)<EOL>result = {stats_key: [], joined_key: []}<EOL>for i, statistic in enumerate(stats):<EOL><INDENT>result[stats_key] += [statistic]<EOL>result[joined_key] += [joined_seq((dict_of_seqs[k][i] for k in keys if k is not stats_key), sep)]<EOL><DEDENT>return list({k: result[stats_key][i]} for i, k in enumerate(result[joined_key]))<EOL><DEDENT>return [{joined_seq((d[k] for k in sorted(d) if k is not stats_key), sep): d[stats_key]} for d in dict_of_seqs]<EOL>
Join (stringify and concatenate) keys (table fields) in a dict (table) of sequences (columns)

    >>> consolidate_stats(dict([('c', [1, 1, 1]), ('cm', ['P', 6, 'Q']), ('cn', [0, 'MUS', 'ROM']),
    ...                        ('ct', [0, 2, 0])]), stats_key='c')
    [{'P,0,0': 1}, {'6,MUS,2': 1}, {'Q,ROM,0': 1}]
    >>> consolidate_stats([{'c': 1, 'cm': 'P', 'cn': 0, 'ct': 0}, {'c': 1, 'cm': 6, 'cn': 'MUS', 'ct': 2},
    ...                    {'c': 1, 'cm': 'Q', 'cn': 'ROM', 'ct': 0}], stats_key='c')
    [{'P,0,0': 1}, {'6,MUS,2': 1}, {'Q,ROM,0': 1}]