code: def assert_is_top_level_func(func: types.FunctionType) -> None:
      """Asserts the func is a top level function.
  
      This check is needed because defining components within a nested class or
      function closure prevents the generated component classes to be referenced by
      their qualified module path.
  
      Args:
        func: The function to be checked.
  
      Raises:
        ValueError if the func is not defined at top level.
      """
      # See https://www.python.org/dev/peps/pep-3155/ for details about the special
      # '<locals>' namespace marker.
      if "<locals>" in func.__qualname__.split("."):
          raise ValueError(
              "The decorator can only be applied to a function defined at the module"
              " level. It cannot be used to construct a component for a function"
              " defined in a nested class or function closure."
          )
  
imports: import enum
  import inspect
  import sys
  import types
  from typing import Any, Dict, Optional, Type
  from tfx import types
  from tfx.dsl.components.base import base_component
  from tfx.dsl.components.base import base_executor
  from tfx.dsl.components.base import executor_spec
  from tfx.types import artifact
  from tfx.types import component_spec
  from tfx.types import system_executions
label_desc: Use image node_id 5 for calling a global function with example usage: assert_is_top_level_func(func) without return types