docs: def _fit_and_score(estimator, X, y, scorer, train, test, verbose, parameters,
                     fit_params, return_train_score=False,
                     return_parameters=False):
      """Fit estimator and compute scores for a given dataset split.
  
      Parameters
      ----------
      estimator : estimator object implementing 'fit'
          The object to use to fit the data.
  
      X : array-like of shape at least 2D
          The data to fit.
  
      y : array-like, optional, default: None
          The target variable to try to predict in the case of
          supervised learning.
  
      scoring : callable
          A scorer callable object / function with signature
          ``scorer(estimator, X, y)``.
  
      train : array-like, shape = (n_train_samples,)
          Indices of training samples.
  
      test : array-like, shape = (n_test_samples,)
          Indices of test samples.
  
      verbose : integer
          The verbosity level.
  
      parameters : dict or None
          Parameters to be set on the estimator.
  
      fit_params : dict or None
          Parameters that will be passed to ``estimator.fit``.
  
      return_train_score : boolean, optional, default: False
          Compute and return score on training set.
  
      return_parameters : boolean, optional, default: False
          Return parameters that has been used for the estimator.
  
      Returns
      -------
      train_score : float, optional
          Score on training set, returned only if `return_train_score` is `True`.
  
      test_score : float
          Score on test set.
  
      n_test_samples : int
          Number of test samples.
  
      scoring_time : float
          Time spent for fitting and scoring in seconds.
  
      parameters : dict or None, optional
          The parameters that have been evaluated.
      """
      if verbose > 1:
          if parameters is None:
              msg = "no parameters to be set"
          else:
              msg = '%s' % (', '.join('%s=%s' % (k, v)
                            for k, v in list(parameters.items())))
          print("[CV] %s %s" % (msg, (64 - len(msg)) * '.'))
  
      # Adjust lenght of sample weights
      n_samples = _num_samples(X)
      fit_params = fit_params if fit_params is not None else {}
      fit_params = dict([(k, np.asarray(v)[train]
                         if hasattr(v, '__len__') and len(v) == n_samples else v)
                         for k, v in list(fit_params.items())])
  
      if parameters is not None:
          estimator.set_params(**parameters)
  
      start_time = time.time()
  
      X_train, y_train = _safe_split(estimator, X, y, train)
      X_test, y_test = _safe_split(estimator, X, y, test, train)
      if y_train is None:
          estimator.fit(X_train, **fit_params)
      else:
          estimator.fit(X_train, y_train, **fit_params)
      test_score = _score(estimator, X_test, y_test, scorer)
      if return_train_score:
          train_score = _score(estimator, X_train, y_train, scorer)
  
      scoring_time = time.time() - start_time
  
      if verbose > 2:
          msg += ", score=%f" % test_score
      if verbose > 1:
          end_msg = "%s -%s" % (msg, logger.short_format_time(scoring_time))
          print("[CV] %s %s" % ((64 - len(end_msg)) * '.', end_msg))
  
      ret = [train_score] if return_train_score else []
      ret.extend([test_score, _num_samples(X_test), scoring_time])
      if return_parameters:
          ret.append(parameters)
      return ret