class DuplicateKeyError(ValueError):
    pass

def dict_no_dupl(it):
    d = {}
for k, v in it:
    if k in d:
        raise DuplicateKeyError(k)
Raise error if a Python dict comprehension overwrites a key