code: def replace(self, item, new_item):
          
          if new_item in self._seen:
              raise ValueError('%r already in list' % new_item)
          idx = self._items.index(item)
          self._seen.remove(item)
          self._seen.add(new_item)
          self._items[idx] = new_item
docs: Replace an item preserving order.
  
          >>> u = Unique([0, 1, 2])
          >>> u.replace(1, 'spam')
          >>> u
          Unique([0, 'spam', 2])
  
          >>> u.replace('eggs', 1)
          Traceback (most recent call last):
              ...
          ValueError: 'eggs' is not in list
  
          >>> u.replace('spam', 0)
          Traceback (most recent call last):
              ...
          ValueError: 0 already in list