code: def _validate_signature(
      func: types.FunctionType,
      argspec: inspect.FullArgSpec,  # pytype: disable=module-attr
      typehints: Dict[str, Any],
      subject_message: str,
  ) -> None:
      """Validates signature of a typehint-annotated component executor function."""
      utils.assert_no_varargs_varkw(argspec, subject_message)
  
      # Validate argument type hints.
      for arg in argspec.args:
          if isinstance(arg, list):
              # Note: this feature was removed in Python 3:
              # https://www.python.org/dev/peps/pep-3113/.
              raise ValueError(
                  "%s does not support nested input arguments."
                  % subject_message
              )
          if arg not in typehints:
              raise ValueError(
                  "%s must have all arguments annotated with typehints."
                  % subject_message
              )
  
      # Validate return type hints.
      if return_kwargs := _parse_return_type_kwargs(func, typehints):
          for arg, arg_typehint in return_kwargs.items():
              if isinstance(
                  arg_typehint, annotations.OutputArtifact
              ) or (
                  inspect.isclass(arg_typehint)
                  and issubclass(arg_typehint, artifact.Artifact)
              ):
                  raise ValueError(
                      f"@component {func.__name__} output artifact {arg!r} should be"
                      f" declared as a function parameter `{arg}:"
                      " tfx.v1.dsl.components.OutputArtifact[T]` where T is a subclass of"
                      " `tfx.v1.dsl.Artifact`. They should not be declared as part of the"
                      " return value output dict."
                  )
  
file_path: tfx/tfx/dsl/component/experimental/function_parser.py
imports: import inspect
  import sys
  import types
  import typing
  from typing import Any, Dict, NamedTuple, Optional, Type, Union, get_args, get_origin
  from tfx.dsl.component.experimental import annotations
  from tfx.dsl.component.experimental import json_compat
  from tfx.dsl.component.experimental import utils
  from tfx.types import artifact
  from tfx.types import standard_artifacts
  import typing_extensions
label_desc: Use image node_id 3 for calling a global function with example usage: _validate_signature(func, argspec, typehints, subject_message) without return types