code: def _delete(self, pos, idx):
          
          _maxes, _lists, _index = self._maxes, self._lists, self._index
  
          lists_pos = _lists[pos]
  
          del lists_pos[idx]
          self._len -= 1
  
          len_lists_pos = len(lists_pos)
  
          if len_lists_pos > self._half:
  
              _maxes[pos] = lists_pos[-1]
  
              if _index:
                  child = self._offset + pos
                  while child > 0:
                      _index[child] -= 1
                      child = (child - 1) >> 1
                  _index[0] -= 1
  
          elif len(_lists) > 1:
  
              if not pos:
                  pos += 1
  
              prev = pos - 1
              _lists[prev].extend(_lists[pos])
              _maxes[prev] = _lists[prev][-1]
  
              del _maxes[pos]
              del _lists[pos]
              del _index[:]
  
              self._expand(prev)
  
          elif len_lists_pos:
  
              _maxes[pos] = lists_pos[-1]
  
          else:
  
              del _maxes[pos]
              del _lists[pos]
              del _index[:]
docs: Delete the item at the given (pos, idx).
  
          Combines lists that are less than half the load level.
  
          Updates the index when the sublist length is more than half the load
          level. This requires decrementing the nodes in a traversal from the leaf
          node to the root. For an example traversal see self._loc.