code: def fit_and_score(
      est,
      cv,
      X,
      y,
      n,
      scorer,
      error_score="raise",
      fields=None,
      params=None,
      fit_params=None,
      return_train_score=True,
  ):
      X_train = cv.extract(X, y, n, True, True)
      y_train = cv.extract(X, y, n, False, True)
      X_test = cv.extract(X, y, n, True, False)
      y_test = cv.extract(X, y, n, False, False)
      est_and_time = fit(
          est, X_train, y_train, error_score, fields, params, fit_params
      )
      if not return_train_score:
          X_train = y_train = None
  
      return score(
          est_and_time,
          X_test,
          y_test,
          X_train,
          y_train,
          scorer,
          error_score,
      )
  
imports: from __future__ import absolute_import, division, print_function
  import warnings
  from collections import defaultdict
  from threading import Lock
  from timeit import default_timer
  import numpy
  import packaging.version
  from dask.base import normalize_token
  from scipy import sparse
  from scipy.stats import rankdata
  from sklearn.exceptions import FitFailedWarning
  from sklearn.pipeline import FeatureUnion, Pipeline
  from sklearn.utils.validation import check_consistent_length
  from toolz import pluck
  from .._compat import Mapping
  from .utils import _index_param_value, _num_samples, _safe_indexing, copy_estimator
label_desc: Use image node_id 15 for calling a global function with example usage: fit_and_score(est, cv, X, y, n, scorer, error_score, fields, params, fit_params, return_train_score) and returns: score