docs: def _shuffle(y, labels, random_state):
      """Return a shuffled copy of y eventually shuffle among same labels."""
      if labels is None:
          ind = random_state.permutation(len(y))
      else:
          ind = np.arange(len(labels))
          for label in np.unique(labels):
              this_mask = (labels == label)
              ind[this_mask] = random_state.permutation(ind[this_mask])
      return y[ind]