code: def to_part(part: PartType):
      if isinstance(part, Mapping):
          part = _convert_dict(part)
  
      if isinstance(part, glm.Part):
          return part
      elif isinstance(part, str):
          return glm.Part(text=part)
      else:
          # Maybe it can be turned into a blob?
          return glm.Part(inline_data=to_blob(part))
  
imports: from __future__ import annotations
  from collections.abc import Iterable, Mapping
  import io
  import mimetypes
  import pathlib
  import typing
  from typing import Any, TypedDict, Union
  from google.ai import generativelanguage
label_desc: Use image node_id 7 for calling a global function with example usage: to_part(part) and returns: part, glm, glm