code: def create_cv_results(
      scores,
      candidate_params,
      n_splits,
      error_score,
      weights,
      multimetric,
  ):
      if len(scores[0]) == 4:
          fit_times, test_scores, score_times, train_scores = zip(
              *scores
          )
      else:
          fit_times, test_scores, score_times = zip(*scores)
          train_scores = None
  
      if not multimetric:
          test_scores = [
              error_score if s is FIT_FAILURE else s
              for s in test_scores
          ]
          if train_scores is not None:
              train_scores = [
                  error_score if s is FIT_FAILURE else s
                  for s in train_scores
              ]
      else:
          test_scores = {
              k: [
                  error_score if x is FIT_FAILURE else x[k]
                  for x in test_scores
              ]
              for k in multimetric
          }
          if train_scores is not None:
              train_scores = {
                  k: [
                      error_score if x is FIT_FAILURE else x[k]
                      for x in train_scores
                  ]
                  for k in multimetric
              }
  
      # Construct the `cv_results_` dictionary
      results = {"params": candidate_params}
      n_candidates = len(candidate_params)
  
      if weights is not None:
          weights = np.broadcast_to(
              weights[None, :], (len(candidate_params), len(weights))
          )
  
      _store(results, "fit_time", fit_times, n_splits, n_candidates)
      _store(results, "score_time", score_times, n_splits, n_candidates)
  
      if not multimetric:
          _store(
              results,
              "test_score",
              test_scores,
              n_splits,
              n_candidates,
              splits=True,
              rank=True,
              weights=weights,
          )
          if train_scores is not None:
              _store(
                  results,
                  "train_score",
                  train_scores,
                  n_splits,
                  n_candidates,
                  splits=True,
              )
      else:
          for key in multimetric:
              _store(
                  results,
                  "test_{}".format(key),
                  test_scores[key],
                  n_splits,
                  n_candidates,
                  splits=True,
                  rank=True,
                  weights=weights,
              )
          if train_scores is not None:
              for key in multimetric:
                  _store(
                      results,
                      "train_{}".format(key),
                      train_scores[key],
                      n_splits,
                      n_candidates,
                      splits=True,
                  )
  
      # Use one MaskedArray and mask all the places where the param is not
      # applicable for that candidate. Use defaultdict as each candidate may
      # not contain all the params
      param_results = defaultdict(
          lambda: MaskedArray(
              np.empty(n_candidates), mask=True, dtype=object
          )
      )
      for cand_i, params in enumerate(candidate_params):
          for name, value in params.items():
              param_results["param_%s" % name][cand_i] = value
  
      results.update(param_results)
      return results
  
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 17 for calling a global function with example usage: create_cv_results(scores, candidate_params, n_splits, error_score, weights, multimetric) and returns: results