code: def format_with_first_or_last(
      time_granularity: TimeGranularity,
  ) -> bool:
      """Indicates that this can only be calculated if query results display the first or last date of the period."""
      return time_granularity in [
          TimeGranularity.MONTH,
          TimeGranularity.QUARTER,
          TimeGranularity.YEAR,
      ]
  
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 2 for calling a global function with example usage: format_with_first_or_last(time_granularity) and returns: unknown