code: def update_tuned_model(
      tuned_model: str | glm.TunedModel,
      updates: dict[str, Any] | None = None,
      *,
      client: glm.ModelServiceClient | None = None,
  ) -> model_types.TunedModel:
      """Push updates to the tuned model. Only certain attributes are updatable."""
      if client is None:
          client = get_default_model_client()
  
      if isinstance(tuned_model, str):
          name = tuned_model
          if not isinstance(updates, dict):
              raise TypeError(
                  "When calling `update_tuned_model(name:str, updates: dict)`,\n"
                  "`updates` must be a `dict`.\n"
                  f"got: {type(updates)}"
              )
          tuned_model = client.get_tuned_model(name=name)
  
          updates = _flatten_update_paths(updates)
          field_mask = field_mask_pb2.FieldMask()
          for path in updates.keys():
              field_mask.paths.append(path)
          for path, value in updates.items():
              _apply_update(tuned_model, path, value)
      elif isinstance(tuned_model, glm.TunedModel):
          if updates is not None:
              raise ValueError(
                  "When calling `update_tuned_model(tuned_model:glm.TunedModel, updates=None)`,"
                  "`updates` must not be set."
              )
  
          name = tuned_model.name
          was = client.get_tuned_model(name=name)
          field_mask = protobuf_helpers.field_mask(
              was._pb, tuned_model._pb
          )
      else:
          raise TypeError(
              "For `update_tuned_model(tuned_model:dict|glm.TunedModel)`,"
              f"`tuned_model` must be a `dict` or a `glm.TunedModel`. Got a: `{type(tuned_model)}`"
          )
  
      result = client.update_tuned_model(
          glm.UpdateTunedModelRequest(
              tuned_model=tuned_model, update_mask=field_mask
          )
      )
      return model_types.decode_tuned_model(result)
  
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 10 for calling a global function with example usage: update_tuned_model(tuned_model, updates) and returns: model_types