code: def get_output_type(func: Callable) -> Type:
      """Returns the output type of a given function (callable).
  
      Args:
          func: The function for which to get the output type.
  
      Raises:
          ValueError: If the function does not have a valid output type annotation.
      """
      type_hints = get_type_hints(func)
      if "return" not in type_hints:
          raise ValueError(
              "The return type of the callable MUST be annotated with type hints."
              "For example: `def my_opyrator(input: InputModel) -> OutputModel:`."
          )
  
      output_type = type_hints["return"]
  
      if not is_compatible_type(output_type):
          raise ValueError(
              "The return value MUST be a subclass of the Pydantic BaseModel or a list of Pydantic models."
          )
  
      return output_type
  
file_path: opyrator/src/opyrator/core.py
imports: import importlib
  import inspect
  import re
  from typing import Any, Callable, Type, Union, get_type_hints
  from pydantic import BaseModel, parse_raw_as
  from pydantic.tools import parse_obj_as
label_desc: Use image node_id 4 for calling a global function with example usage: get_output_type(func) and returns: output_type