code: def _pipeline_transform(
      pipeline: ForecastingPipeline,
      y: pd.Series,
      X: Optional[pd.DataFrame] = None,
  ) -> Tuple[pd.Series, Optional[pd.DataFrame]]:
      """Transforms y and X based on the transformations present in the pipeline.
  
      Reminder: The pipeline structure is as follows:
      ForecastingPipeline
          - TransformerPipeline(exogenous_steps) [Optional]
          - TransformedTargetForecaster
              - TransformerPipeline(target_steps) [Optional]
              - model
  
      Parameters
      ----------
      pipeline : ForecastingPipeline
          The pipeline used for modeling
      y : pd.Series
          Original target values
      X : pd.DataFrame, optional
          Original exogenous values, by default None
  
      Returns
      -------
      Tuple[pd.Series, Optional[pd.DataFrame]]
          The transformed values for y and X. If no transformations are present in
          the pipeline, then the values are returned as is ("unity" transformation).
      """
      # Get X Transformations ----
      if X is not None:
          _, potential_tx = pipeline.steps_[0]
          if isinstance(potential_tx, TransformerPipeline):
              X = potential_tx.transform(X)
  
      # Get y Transformations ----
      _, forecaster = pipeline.steps_[-1]
      _, potential_tx = forecaster.steps_[0]
      if isinstance(potential_tx, TransformerPipeline):
          y = potential_tx.transform(y)
  
      return y, X
  
file_path: pycaret/pycaret/utils/time_series/forecasting/pipeline.py
imports: from copy import deepcopy
  from typing import Optional, Tuple
  import pandas
  from sktime.forecasting.base import BaseForecaster
  from sktime.forecasting.compose import ForecastingPipeline
  from sktime.transformations.compose import TransformerPipeline
  from sktime.transformations.series.impute import Imputer
label_desc: Use image node_id 7 for calling a global function with example usage: _pipeline_transform(pipeline, y, X) and returns: y,  X