docs: def extend(self, values):
          """
          Extend the list by appending all elements from the *values*. Raises a
          ValueError if the sort order would be violated.
          """
          _maxes, _lists, _load = self._maxes, self._lists, self._load
  
          if not isinstance(values, list):
              values = list(values)
  
          if any(values[pos - 1] > values[pos]
                 for pos in range(1, len(values))):
              raise ValueError('given sequence not in sort order')
  
          offset = 0
  
          if _maxes:
              if values[0] < _lists[-1][-1]:
                  msg = '{0} not in sort order at index {1}'.format(repr(values[0]), self._len)
                  raise ValueError(msg)
  
              if len(_lists[-1]) < self._half:
                  _lists[-1].extend(values[:_load])
                  _maxes[-1] = _lists[-1][-1]
                  offset = _load
  
          len_lists = len(_lists)
  
          for idx in range(offset, len(values), _load):
              _lists.append(values[idx:(idx + _load)])
              _maxes.append(_lists[-1][-1])
  
          _index = self._index
  
          if len_lists == len(_lists):
              len_index = len(_index)
              if len_index > 0:
                  len_values = len(values)
                  child = len_index - 1
                  while child:
                      _index[child] += len_values
                      child = (child - 1) >> 1
                  _index[0] += len_values
          else:
              del _index[:]
  
          self._len += len(values)