code: def _extract_freq_from_cutoff(x) -> Optional[str]:
      """Extract frequency string from cutoff.
  
      Parameters
      ----------
      x : pd.Period, pd.PeriodIndex, pd.DatetimeIndex
  
      Returns
      -------
      str : Frequency string or None
      """
      if isinstance(x, (pd.Period, pd.PeriodIndex, pd.DatetimeIndex)):
          return x.freq
      else:
          return None
  
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 4 for calling a global function with example usage: _extract_freq_from_cutoff(x) and returns: x, None