code: def string_to_time_granularity(s: str) -> TimeGranularity:  # noqa: D
      values = {item.value: item for item in TimeGranularity}
      return values[s]
  
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 10 for calling a global function with example usage: string_to_time_granularity(s) and returns: values