import collections


def _AggregateDicts(dicts):
  """Turn a sequence of dictionaries into a dictionary of lists."""
  result = collections.defaultdict(list)
  for d in dicts:
    for k, v in d.iteritems():
      result[k].append(v)
  return result