from typing import OrderedDict


def records2lists(records):
    """ converts a list of dicts (records) to 
    a dict with lists (O(n))
    """
    keys = records[0].keys()
    lists = OrderedDict([(k, [r[k] for r in records]) for k in keys])

    return lists