def correlate_dicts(dicts, key):
    ret = {}
    i = 0
    for d in dicts:
        try:
            my_key = d[key]
        except KeyError:
            msg = "'dicts' element %d contains no key '%s'"
            tup = i, key 
            raise KeyError(msg % tup)
        ret[my_key] = d
        i += 1
    return ret
Correlate several dicts under one superdict.
dataset/ETHPy150Open mikeorr/WebHelpers2/webhelpers2/containers.py/correlate_dicts