code: def pop(self, index=None):
      
      if not self.items:
          raise KeyError('Set is empty')
  
      def remove_index(i):
          elem = self.items[i]
          del self.items[i]
          del self.map[elem]
          return elem
      if index is None:
          elem = remove_index(-1)
      else:
          size = len(self.items)
          if index < 0:
              index = size + index
              if index < 0:
                  raise IndexError('assignement index out of range')
          elif index >= size:
              raise IndexError('assignement index out of range')
          elem = remove_index(index)
          for k, v in self.map.items():
              if v >= index and v > 0:
                  self.map[k] = v - 1
      return elem
docs: Removes an element at the tail of the OrderedSet or at a dedicated
      position.
  
      This implementation is meant for the OrderedSet from the ordered_set
      package only.