code: def _check_cutoff(cutoff, index):
      """Check if the cutoff is valid based on time index of forecasting horizon.
  
      Validates that the cutoff is
      compatible with the time index of the forecasting horizon.
  
      Parameters
      ----------
      cutoff : pd.Period, pd.Timestamp, int, optional (default=None)
          Cutoff value is required to convert a relative forecasting
          horizon to an absolute one and vice versa.
      index : pd.PeriodIndex or pd.DataTimeIndex
          Forecasting horizon time index that the cutoff value will be checked
          against.
      """
      if cutoff is None:
          raise ValueError("`cutoff` must be given, but found none.")
  
      if isinstance(index, pd.PeriodIndex):
          assert isinstance(cutoff, (pd.Period, pd.PeriodIndex))
          assert index.freqstr == cutoff.freqstr
  
      if isinstance(index, pd.DatetimeIndex):
          assert isinstance(cutoff, (pd.Timestamp, pd.DatetimeIndex))
  
imports: from functools import lru_cache
  from typing import Optional, Union
  import numpy
  import pandas
  from pandas.tseries.frequencies import to_offset
  from sktime.utils.datetime import _coerce_duration_to_int
  from sktime.utils.validation import array_is_int, array_is_timedelta_or_date_offset, is_array, is_int, is_timedelta_or_date_offset
  from sktime.utils.validation._dependencies import _check_soft_dependencies
  from sktime.utils.validation.series import VALID_INDEX_TYPES, is_in_valid_absolute_index_types, is_in_valid_index_types, is_in_valid_relative_index_types, is_integer_index
label_desc: Use image node_id 7 for calling a global function with example usage: _check_cutoff(cutoff, index) without return types