code: def time_features_from_frequency_str(
      freq_str: str,
  ) -> List[TimeFeature]:
      """
      Returns a list of time features that will be appropriate for the given
      frequency string.
  
      Parameters
      ----------
  
      freq_str
          Frequency string of the form [multiple][granularity] such as "12H",
          "5min", "1D" etc.
      """
  
      features_by_offsets: Dict[Any, List[TimeFeature]] = {
          offsets.YearBegin: [],
          offsets.YearEnd: [],
          offsets.QuarterBegin: [month_of_year],
          offsets.QuarterEnd: [month_of_year],
          offsets.MonthBegin: [month_of_year],
          offsets.MonthEnd: [month_of_year],
          offsets.Week: [day_of_month, week_of_year],
          offsets.Day: [day_of_week, day_of_month, day_of_year],
          offsets.BusinessDay: [day_of_week, day_of_month, day_of_year],
          offsets.Hour: [
              hour_of_day,
              day_of_week,
              day_of_month,
              day_of_year,
          ],
          offsets.Minute: [
              minute_of_hour,
              hour_of_day,
              day_of_week,
              day_of_month,
              day_of_year,
          ],
          offsets.Second: [
              second_of_minute,
              minute_of_hour,
              hour_of_day,
              day_of_week,
              day_of_month,
              day_of_year,
          ],
      }
  
      offset = to_offset(freq_str)
  
      for offset_type, features in features_by_offsets.items():
          if isinstance(offset, offset_type):
              return features
  
      supported_freq_msg = f"""
      Unsupported frequency {freq_str}
  
      The following frequencies are supported:
  
          Y   - yearly
              alias: A
          Q   - quarterly
          M   - monthly
          W   - weekly
          D   - daily
          B   - business days
          H   - hourly
          T   - minutely
              alias: min
          S   - secondly
      """
      raise RuntimeError(supported_freq_msg)
  
imports: from typing import Any, Callable, Dict, List
  import numpy
  import pandas
  from pandas.tseries import offsets
  from pandas.tseries.frequencies import to_offset
  from gluonts.pydantic import BaseModel
label_desc: Use image node_id 19 for calling a global function with example usage: time_features_from_frequency_str(freq_str) and returns: features