code: def _shuffle(y, groups, random_state):
      """Return a shuffled copy of y eventually shuffle among same groups."""
      if groups is None:
          indices = random_state.permutation(len(y))
      else:
          indices = np.arange(len(groups))
          for group in np.unique(groups):
              this_mask = groups == group
              indices[this_mask] = random_state.permutation(
                  indices[this_mask]
              )
      return y[indices]
  
imports: from __future__ import print_function
  from __future__ import division
  import warnings
  import numbers
  import time
  import numpy
  import scipy.sparse
  from ..base import is_classifier, clone
  from ..utils import indexable, check_random_state, safe_indexing
  from ..utils.fixes import astype
  from ..utils.validation import _is_arraylike, _num_samples
  from ..utils.metaestimators import _safe_split
  from ..externals.joblib import Parallel, delayed, logger
  from ..metrics.scorer import check_scoring
  from ..exceptions import FitFailedWarning
  from ._split import check_cv
label_desc: Use image node_id 10 for calling a global function with example usage: _shuffle(y, groups, random_state) and returns: y