code: def is_period_start(
      time_granularity: TimeGranularity, date: Union[pd.Timestamp, date]
  ) -> bool:  # noqa: D
      pd_date = pd.Timestamp(date)
  
      if time_granularity is TimeGranularity.DAY:
          return True
      elif time_granularity is TimeGranularity.WEEK:
          return ISOWeekDay.from_pandas_timestamp(pd_date).is_week_start
      elif time_granularity is TimeGranularity.MONTH:
          return pd_date.is_month_start
      elif time_granularity is TimeGranularity.QUARTER:
          return pd_date.is_quarter_start
      elif time_granularity is TimeGranularity.YEAR:
          return pd_date.is_year_start
      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 3 for calling a global function with example usage: is_period_start(time_granularity, date) and returns: True, ISOWeekDay, pd_date, pd_date, pd_date