code: def _dict_raise_on_duplicates(ordered_pairs):
      
      d = {}
      for k, v in ordered_pairs:
          if k in d:
             raise ValueError("duplicate key: %r" % (k,))
          else:
             d[k] = v
      return d
docs: Reject duplicate keys.