code: def period_begin_offset(  # noqa: D
      time_granularity: TimeGranularity,
  ) -> Union[
      pd.offsets.MonthBegin,
      pd.offsets.QuarterBegin,
      pd.offsets.Week,
      pd.offsets.YearBegin,
  ]:
      if time_granularity is TimeGranularity.DAY:
          raise ValueError(
              f"Can't get period start offset for TimeGranularity.{time_granularity.name}."
          )
      elif time_granularity is TimeGranularity.WEEK:
          return pd.offsets.Week(weekday=ISOWeekDay.MONDAY.pandas_value)
      elif time_granularity is TimeGranularity.MONTH:
          return pd.offsets.MonthBegin()
      elif time_granularity is TimeGranularity.QUARTER:
          return pd.offsets.QuarterBegin(startingMonth=1)
      elif time_granularity is TimeGranularity.YEAR:
          return pd.offsets.YearBegin()
      else:
          assert_values_exhausted(time_granularity)
  
imports: from __future__ import annotations
  from datetime import date
  from typing import Union
  import pandas
  from dbt_semantic_interfaces.enum_extension import ExtendedEnum, assert_values_exhausted
  from dbt_semantic_interfaces.type_enums.time_granularity import TimeGranularity
label_desc: Use image node_id 5 for calling a global function with example usage: period_begin_offset(time_granularity) and returns: pd, pd, pd, pd