code: def dedupe_by(things, key=None):
      
      if not key:
          key = hash
      index = {key(thing): thing for thing in things}
      return index.values()
docs: Given an iterator of things and an optional key generation function, return
      a new iterator of deduped things. Things are compared and de-duped by the
      key function, which is hash() by default.