code: def _check_series(y):
      """
      Check whether y is pandas.Series. Pycaret Experiment
      internally converts data to pandas.DataFrame.
      """
      if isinstance(y, pd.Series):
          return y
      elif isinstance(y, pd.DataFrame):
          return _set_y_as_series(y)
  
imports: from typing import Any, Dict, Optional, Union
  import numpy
  import pandas
  from sklearn import metrics
  from sklearn.metrics._scorer import _BaseScorer
  from sktime.performance_metrics.forecasting._functions import mean_absolute_percentage_error, mean_absolute_scaled_error, mean_squared_scaled_error
  import pycaret.internal.metrics
  from pycaret.containers.metrics.base_metric import MetricContainer
label_desc: Use image node_id 6 for calling a global function with example usage: _check_series(y) and returns: y, _set_y_as_series