code: def _check_window_lengths(
      y: pd.Index,
      fh: ForecastingHorizon,
      window_length: NON_FLOAT_WINDOW_LENGTH_TYPES,
      initial_window: NON_FLOAT_WINDOW_LENGTH_TYPES,
  ) -> None:
      """Check that combination of inputs is compatible.
  
      Parameters
      ----------
      y : pd.Index
          Index of time series
      fh : int, timedelta, list or np.ndarray of ints or timedeltas
      window_length : int or timedelta or pd.DateOffset
      initial_window : int or timedelta or pd.DateOffset
          Window length of first window
  
      Raises
      ------
      ValueError
          if window length plus max horizon is above the last observation in `y`,
          or if initial window plus max horizon is above the last observation in `y`
      TypeError
          if type of the input is not supported
      """
      n_timepoints = y.shape[0]
      fh_max = fh[-1]
  
      error_msg_for_incompatible_window_length = (
          f"The `window_length` and the forecasting horizon are incompatible "
          f"with the length of `y`. Found `window_length`={window_length}, "
          f"`max(fh)`={fh_max}, but len(y)={n_timepoints}. "
          f"It is required that the window length plus maximum forecast horizon "
          f"is smaller than the length of the time series `y` itself."
      )
      if is_timedelta_or_date_offset(x=window_length):
          if y[0] + window_length + fh_max > y[-1]:
              raise ValueError(error_msg_for_incompatible_window_length)
      else:
          if window_length + fh_max > n_timepoints:
              raise ValueError(error_msg_for_incompatible_window_length)
  
      error_msg_for_incompatible_initial_window = (
          f"The `initial_window` and the forecasting horizon are incompatible "
          f"with the length of `y`. Found `initial_window`={initial_window}, "
          f"`max(fh)`={fh_max}, but len(y)={n_timepoints}. "
          f"It is required that the initial window plus maximum forecast horizon "
          f"is smaller than the length of the time series `y` itself."
      )
      error_msg_for_incompatible_types = (
          "The `initial_window` and `window_length` types are incompatible. "
          "They should be either all timedelta or all int."
      )
      if initial_window is not None:
          if is_timedelta_or_date_offset(x=initial_window):
              if y[0] + initial_window + fh_max > y[-1]:
                  raise ValueError(
                      error_msg_for_incompatible_initial_window
                  )
              if not is_timedelta_or_date_offset(x=window_length):
                  raise TypeError(error_msg_for_incompatible_types)
          else:
              if initial_window + fh_max > n_timepoints:
                  raise ValueError(
                      error_msg_for_incompatible_initial_window
                  )
              if is_timedelta_or_date_offset(x=window_length):
                  raise TypeError(error_msg_for_incompatible_types)
  
imports: from typing import Optional
  import numpy
  import pandas
  from sktime.datatypes._utilities import get_index_for_series
  from sktime.forecasting.base import ForecastingHorizon
  from sktime.split.base import BaseSplitter
  from sktime.split.base._common import ACCEPTED_Y_TYPES, FORECASTING_HORIZON_TYPES, SPLIT_ARRAY_TYPE, SPLIT_GENERATOR_TYPE, _check_fh, _check_inputs_for_compatibility, _get_end
  from sktime.utils.validation import ACCEPTED_WINDOW_LENGTH_TYPES, NON_FLOAT_WINDOW_LENGTH_TYPES, array_is_int, check_window_length, is_int, is_timedelta_or_date_offset
  from sktime.utils.validation.forecasting import check_step_length
label_desc: Use image node_id 1 for calling a global function with example usage: _check_window_lengths(y, fh, window_length, initial_window) without return types