code: def check_y_X(
      y,
      X=None,
      allow_empty=False,
      allow_constant=True,
      enforce_index_type=None,
  ):
      """Validate input data.
  
      Parameters
      ----------
      y : pd.Series
      X : pd.DataFrame, optional (default=None)
      allow_empty : bool, optional (default=False)
          If True, empty `y` does not raise an error.
      allow_constant : bool, optional (default=True)
          If True, constant `y` does not raise an error.
      enforce_index_type : type, optional (default=None)
          type of time index
  
      Raises
      ------
      ValueError
          If y or X are invalid inputs
      """
      y = check_y(
          y,
          allow_empty=allow_empty,
          allow_constant=allow_constant,
          enforce_index_type=enforce_index_type,
      )
  
      if X is not None:
          # No need to also enforce the index type on X since we're
          # checking for index equality here
          X = check_X(X)
          check_equal_time_index(y, X)
  
      return y, X
  
file_path: sktime/sktime/utils/validation/forecasting.py
imports: from datetime import timedelta
  from typing import Optional, Union
  import numpy
  import pandas
  from sklearn.base import clone, is_regressor
  from sklearn.ensemble import GradientBoostingRegressor
  from sktime.utils.validation import array_is_datetime64, array_is_int, is_date_offset, is_int, is_timedelta
  from sktime.utils.validation.series import check_equal_time_index, check_series
label_desc: Use image node_id 1 for calling a global function with example usage: check_y_X(y, X, allow_empty, allow_constant, enforce_index_type) and returns: y,  X