docs: def _inverse_permutation_indices(positions):
      """Like inverse_permutation, but also handles slices.
  
      Parameters
      ----------
      positions : list of np.ndarray or slice objects.
          If slice objects, all are assumed to be slices.
  
      Returns
      -------
      np.ndarray of indices or None, if no permutation is necessary.
      """
      if not positions:
          return None
  
      if isinstance(positions[0], slice):
          positions = _consolidate_slices(positions)
          if positions == slice(None):
              return None
          positions = [np.arange(sl.start, sl.stop, sl.step) for sl in positions]
  
      indices = nputils.inverse_permutation(np.concatenate(positions))
      return indices