code: def remove(self, val):
          
          _maxes = self._maxes
  
          if not _maxes:
              raise ValueError('{0} not in list'.format(repr(val)))
  
          key = self._key(val)
          pos = bisect_left(_maxes, key)
  
          if pos == len(_maxes):
              raise ValueError('{0} not in list'.format(repr(val)))
  
          _keys = self._keys
          _lists = self._lists
          idx = bisect_left(_keys[pos], key)
  
          len_keys = len(_keys)
          len_sublist = len(_keys[pos])
  
          while True:
              if _keys[pos][idx] != key:
                  raise ValueError('{0} not in list'.format(repr(val)))
              if _lists[pos][idx] == val:
                  self._delete(pos, idx)
                  return
              idx += 1
              if idx == len_sublist:
                  pos += 1
                  if pos == len_keys:
                      raise ValueError('{0} not in list'.format(repr(val)))
                  len_sublist = len(_keys[pos])
                  idx = 0
docs: Remove first occurrence of *val*.
  
          Raises ValueError if *val* is not present.