code: def append(self, val):
          
          _maxes, _lists, _keys = self._maxes, self._lists, self._keys
  
          key = self._key(val)
  
          if not _maxes:
              _maxes.append(key)
              _keys.append([key])
              _lists.append([val])
              self._len = 1
              return
  
          pos = len(_keys) - 1
  
          if key < _keys[pos][-1]:
              msg = '{0} not in sort order at index {1}'.format(repr(val), self._len)
              raise ValueError(msg)
  
          _maxes[pos] = key
          _keys[pos].append(key)
          _lists[pos].append(val)
          self._len += 1
          self._expand(pos)
docs: Append the element *val* to the list. Raises a ValueError if the *val*
          would violate the sort order.