code: def _fix_valid_indices(cls, valid_indices, insertion_index, dim):
          
          # TODO: make this accept an immutable sequence for valid_indices
          # (a tuple) and return an immutable sequence rather than mutating an
          # argument.
          indices = np.array(sorted(valid_indices[dim]))
          slice_index = np.sum(indices <= insertion_index)
          indices[slice_index:] += 1
          indices = np.insert(indices, slice_index, insertion_index + 1)
          valid_indices[dim] = indices.tolist()
          return valid_indices
docs: Add indices for H&S inserted elements.