code: def to_content(content: ContentType):
      if not content:
          raise ValueError("content must not be empty")
  
      if isinstance(content, Mapping):
          content = _convert_dict(content)
  
      if isinstance(content, glm.Content):
          return content
      elif isinstance(content, Iterable) and not isinstance(
          content, str
      ):
          return glm.Content(parts=[to_part(part) for part in content])
      else:
          # Maybe this is a Part?
          return glm.Content(parts=[to_part(content)])
  
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 9 for calling a global function with example usage: to_content(content) and returns: content, glm, glm