code: def _get_end(y_index: pd.Index, fh: ForecastingHorizon) -> int:
      """Compute the end of the last training window for a forecasting horizon.
  
      For a time series index `y_index`, `y_index[end]` will give
      the index of the training window.
      Correspondingly, for a time series `y` with index `y_index`,
      `y.iloc[end]` or `y.loc[y_index[end]]`
      will provide the last index of the training window.
  
      Parameters
      ----------
      y_index : pd.Index
          Index of time series
      fh : int, timedelta, list or np.ndarray of ints or timedeltas
  
      Returns
      -------
      end : int
          0-indexed integer end of the training window
      """
      # `fh` is assumed to be ordered and checked by `_check_fh` and `window_length` by
      # `check_window_length`.
      n_timepoints = y_index.shape[0]
      assert isinstance(y_index, pd.Index)
  
      # For purely in-sample forecasting horizons, the last split point is the end of the
      # training data.
      # Otherwise, the last point must ensure that the last horizon is within the data.
      null = 0 if array_is_int(fh) else pd.Timedelta(0)
      fh_offset = null if fh.is_all_in_sample() else fh[-1]
      if array_is_int(fh):
          return n_timepoints - fh_offset - 1
      return y_index.get_loc(y_index[-1] - fh_offset)
  
file_path: sktime/sktime/split/base/_common.py
imports: from typing import Iterator, Optional, Tuple, Union
  import numpy
  import pandas
  from sktime.datatypes._utilities import get_window
  from sktime.forecasting.base import ForecastingHorizon
  from sktime.forecasting.base._fh import VALID_FORECASTING_HORIZON_TYPES
  from sktime.utils.validation import all_inputs_are_iloc_like, all_inputs_are_time_like, array_is_int, is_int
  from sktime.utils.validation.forecasting import check_fh
  from sktime.utils.validation.series import check_equal_time_index
label_desc: Use image node_id 4 for calling a global function with example usage: _get_end(y_index, fh) and returns: y_index, unknown