code: def get_base_model_name(
      model: model_types.AnyModelNameOptions,
      client: glm.ModelServiceClient | None = None,
  ):
      if isinstance(model, str):
          if model.startswith("tunedModels/"):
              model = get_model(model, client=client)
              base_model = model.base_model
          else:
              base_model = model
      elif isinstance(model, model_types.TunedModel):
          base_model = model.base_model
      elif isinstance(model, model_types.Model):
          base_model = model.name
      elif isinstance(model, glm.Model):
          base_model = model.name
      elif isinstance(model, glm.TunedModel):
          base_model = getattr(model, "base_model", None)
          if not base_model:
              base_model = model.tuned_model_source.base_model
      else:
          raise TypeError(f"Cannot understand model: {model}")
  
      return base_model
  
imports: from __future__ import annotations
  import typing
  from typing import Any, Literal
  import google.ai.generativelanguage
  from google.generativeai import operations
  from google.generativeai.client import get_default_model_client
  from google.generativeai.types import model_types
  from google.api_core import operation
  from google.api_core import protobuf_helpers
  from google.protobuf import field_mask_pb2
label_desc: Use image node_id 4 for calling a global function with example usage: get_base_model_name(model, client) and returns: base_model