code: def adjust_to_start_of_period(
      time_granularity: TimeGranularity,
      date_to_adjust: pd.Timestamp,
      rollback: bool = True,
  ) -> pd.Timestamp:
      """Adjust to start of period if not at start already."""
      if rollback:
          return period_begin_offset(time_granularity).rollback(
              date_to_adjust
          )
      else:
          return period_begin_offset(time_granularity).rollforward(
              date_to_adjust
          )
  
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 7 for calling a global function with example usage: adjust_to_start_of_period(time_granularity, date_to_adjust, rollback) and returns: period_begin_offset, period_begin_offset