code: def _permutation_test_score(estimator, X, y, groups, cv, scorer):
      """Auxiliary function for permutation_test_score"""
      avg_score = []
      for train, test in cv.split(X, y, groups):
          estimator.fit(X[train], y[train])
          avg_score.append(scorer(estimator, X[test], y[test]))
      return np.mean(avg_score)
  
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 9 for calling a global function with example usage: _permutation_test_score(estimator, X, y, groups, cv, scorer) and returns: np