def _lod_to_dol(lod):
    """Convert a list-of-dicts into a dict-of-lists.
    
    All the dicts in the input list must have the same keys.
    """
    assert isinstance(lod, list)
    assert len(lod) > 0
    keys = lod[0].keys()
    dol = {k: [] for k in keys}
    for d in lod:
        for k in keys:
            dol[k].append(d[k])
    return dol