code: def get_sp_from_str(str_freq: str) -> int:
      """Takes the seasonal period as string detects if it is alphanumeric and returns its integer equivalent.
          For example -
          input - '30W'
          output - 26
          explanation - we take the lcm of 30 and 52 ( as W = 52) which in this case is 780.
          And the output is ( lcm / prefix). Here, 780 / 30 = 26.
  
      Parameters
      ----------
      str_freq : str
          frequency of the dataset passed as a string
  
      Returns
      -------
      int
          integer equivalent of the string frequency
  
      Raises
      ------
      ValueError
          If the frequency suffix does not correspond to any of the values in the
          class SeasonalPeriod then the error is thrown.
      """
      str_freq = str_freq.split("-")[0] or str_freq
      # Checking whether the index_freq contains both digit and alphabet
      if bool(re.search(r"\d", str_freq)):
          temp = re.compile("([0-9]+)([a-zA-Z]+)")
          res = temp.match(str_freq).groups()
          # separating the digits and alphabets
          if res[1] in SeasonalPeriod.__members__:
              prefix = int(res[0])
              value = SeasonalPeriod[res[1]].value
              lcm = abs(value * prefix) // math.gcd(value, prefix)
              seasonal_period = int(lcm / prefix)
              return seasonal_period
          else:
              raise ValueError(
                  f"Unsupported Period frequency: {str_freq}, valid Period frequency "
                  f"suffixes are: {', '.join(SeasonalPeriod.__members__.keys())}"
              )
      else:
          if str_freq in SeasonalPeriod.__members__:
              seasonal_period = SeasonalPeriod[str_freq].value
              return seasonal_period
          else:
              raise ValueError(
                  f"Unsupported Period frequency: {str_freq}, valid Period frequency "
                  f"suffixes are: {', '.join(SeasonalPeriod.__members__.keys())}"
              )
  
imports: import math
  import re
  import warnings
  from enum import Enum, IntEnum
  from typing import Any, Dict, List, Optional, Tuple
  import numpy
  import pandas
  from pmdarima.arima.utils import ndiffs
  from sktime.param_est.seasonality import SeasonalityACF
  from sktime.transformations.series.difference import Differencer
  from sktime.utils.plotting import plot_series
label_desc: Use image node_id 5 for calling a global function with example usage: get_sp_from_str(str_freq) and returns: seasonal_period, seasonal_period