def sod_transposed(seq_of_dicts, align=True, pad=True, filler=None):
result = {}<EOL>if isinstance(seq_of_dicts, Mapping):<EOL><INDENT>seq_of_dicts = [seq_of_dicts]<EOL><DEDENT>it = iter(seq_of_dicts)<EOL>if not (align and pad):<EOL><INDENT>for d in it:<EOL><INDENT>for k in d:<EOL><INDENT>result[k] = result.get(k, []) + [d[k]]<EOL><DEDENT><DEDENT>return result<EOL><DEDENT>for i, d in enumerate(it):<EOL><INDENT>for k in d:<EOL><INDENT>result[k] = result.get(k, [filler] * (i * int(align))) + [d[k]]<EOL><DEDENT>for k in result:<EOL><INDENT>if k not in d:<EOL><INDENT>result[k] += [filler]<EOL><DEDENT><DEDENT><DEDENT>return result<EOL>
Return sequence (list) of dictionaries, transposed into a dictionary of sequences (lists)

    >>> sorted(sod_transposed([{'c': 1, 'cm': 'P'}, {'c': 1, 'ct': 2, 'cm': 6, 'cn': 'MUS'},
    ...                        {'c': 1, 'cm': 'Q', 'cn': 'ROM'}], filler=0).items())
    [('c', [1, 1, 1]), ('cm', ['P', 6, 'Q']), ('cn', [0, 'MUS', 'ROM']), ('ct', [0, 2, 0])]
    >>> sorted(sod_transposed(({'c': 1, 'cm': 'P'}, {'c': 1, 'ct': 2, 'cm': 6, 'cn': 'MUS'},
    ...                        {'c': 1, 'cm': 'Q', 'cn': 'ROM'}),
    ...                       filler=0, align=0).items())
    [('c', [1, 1, 1]), ('cm', ['P', 6, 'Q']), ('cn', ['MUS', 'ROM']), ('ct', [2])]