docs: def _ranges_key(r, delta_indices):
      """Sorting key for ranges.
  
      When used with ``reverse=True``, this can be used to sort index ranges into
      the order we would prefer to eliminate them by evaluating KroneckerDeltas:
      First, eliminate primed indices, then indices names higher in the alphabet.
      """
      idx = r.index_symbol
      if idx in delta_indices:
          return (r.index_symbol.primed, r.index_symbol.name)
      else:
          # ranges that are not in delta_indices should remain in the original
          # order
          return (0, ' ')