code: def cross_validate(
      pipeline: ForecastingPipeline,
      y: pd.Series,
      X: Optional[Union[pd.Series, pd.DataFrame]],
      cv: Union[ExpandingWindowSplitter, SlidingWindowSplitter],
      scoring: Dict[str, Union[str, _PredictScorer]],
      fit_params: Dict[str, Any],
      n_jobs: Optional[int],
      return_train_score: bool,
      alpha: Optional[float],
      coverage: Union[float, List[float]],
      error_score: float = 0,
      verbose: int = 0,
      **additional_scorer_kwargs,
  ) -> Tuple[Dict[str, np.ndarray], Tuple[Union[pd.PeriodIndex, Any]]]:
      """Performs Cross Validation on time series data
  
      Parallelization is based on `sklearn` cross_validate function [1]
      Ref:
      [1] https://github.com/scikit-learn/scikit-learn/blob/0.24.1/sklearn/model_selection/_validation.py#L246
  
  
      Parameters
      ----------
      pipeline : ForecastingPipeline
          Forecasting Pipeline that needs to be cross-validated.
      y : pd.Series
          Target variable values that need to be used for forecasting. This should be the
          untransformed (original) values. Transformation will happen in the fitting process.
      X : Optional[Union[pd.Series, pd.DataFrame]]
          Exogenous Variable values to be used for forecasting. This should be the
          untransformed (original) values. Transformation will happen in the fitting process.
      cv : Union[ExpandingWindowSplitter, SlidingWindowSplitter]
          The sktime compatible cross-validation object.
      scoring : Dict[str, Union[str, _PredictScorer]]
          Scoring Dictionary. Values can be valid strings that can be converted to
          callable metrics or the callable metrics directly
          e.g.
              {
                  'mae': make_scorer(mean_absolute_error, greater_is_better=False)
                  ,'r2': make_scorer(r2_score)
              }
      fit_params : Dict[str, Any]
          Fit parameters to be used when training the model
          e.g. {'fh': ForecastingHorizon([1, 2, 3], is_relative=True)}
      n_jobs : Optional[int]
          Number of cores to use to parallelize. Refer to sklearn for details
      return_train_score : bool
          Should the training scores be returned. Unused for now.
      alpha: Optional[float]
          The alpha (quantile) value to use for the point predictions.
      coverage: Union[float, List[float]]
          The coverage to be used for prediction intervals.
      error_score : float, optional
          Unused for now, by default 0
      verbose : int
          Sets the verbosity level. Unused for now
      additional_scorer_kwargs: Dict[str, Any]
          Additional scorer kwargs such as {`sp`:12} required by metrics like MASE
  
      Returns
      -------
      Tuple[Dict[str, np.ndarray], Tuple[Union[pd.PeriodIndex, Any]]]
          In order
          (1) Metrics for all folds, e.g.
              {'mae': array([28.32, 30.24, 21.42]), 'rmse': array([33.34, 87.48, 71.21])}
          (2) Cutoff Index value between training and test for each fold, e.g.
              (Period('1956-12', 'M'), Period('1957-12', 'M'), Period('1958-12', 'M'))
  
      Raises
      ------
      Error
          If fit and score raises any exceptions
      """
      try:
          scoring = _get_metrics_dict(scoring)
          parallel = Parallel(n_jobs=n_jobs)
  
          out = parallel(
              delayed(_fit_and_score)(
                  pipeline=clone(pipeline),
                  y=y,
                  X=X,
                  scoring=scoring,
                  train=train,
                  test=test,
                  parameters=None,
                  fit_params=fit_params,
                  return_train_score=return_train_score,
                  alpha=alpha,
                  coverage=coverage,
                  error_score=error_score,
                  **additional_scorer_kwargs,
              )
              for train, test in get_folds(cv, y)
          )
      # raise key exceptions
      except Exception:
          raise
  
      # Similar to parts of _format_results in BaseGridSearch
      (test_scores_dict, fit_time, score_time, cutoffs) = zip(*out)
      test_scores = _aggregate_score_dicts(test_scores_dict)
  
      return test_scores, cutoffs
  
imports: import time
  import warnings
  from collections import defaultdict
  from functools import partial
  from typing import Any, Dict, Generator, List, Optional, Tuple, Union
  import numpy
  import pandas
  from joblib import Parallel, delayed
  from scipy.stats import rankdata
  from sklearn.base import clone
  from sklearn.metrics._scorer import _PredictScorer
  from sklearn.model_selection import ParameterGrid, ParameterSampler, check_cv
  from sklearn.model_selection._validation import _aggregate_score_dicts
  from sktime.forecasting.compose import ForecastingPipeline
  from sktime.forecasting.model_selection import ExpandingWindowSplitter, SlidingWindowSplitter
  from sktime.utils.validation.forecasting import check_y_X
  from pycaret.internal.logging import get_logger
  from pycaret.utils.generic import _get_metrics_dict, get_function_params
  from pycaret.utils.time_series.forecasting import get_predictions_with_intervals, update_additional_scorer_kwargs
  from pycaret.utils.time_series.forecasting.pipeline import _get_imputed_data
label_desc: Use image node_id 3 for calling a global function with example usage: cross_validate(pipeline, y, X, cv, scoring, fit_params, n_jobs, return_train_score, alpha, coverage, error_score, verbose) and returns: test_scores,  cutoffs