code: def check_union_annotation(
      annotation: Any,
      parameter_check_func: Optional[Callable[[Any], bool]] = None,
  ) -> bool:
      import typing
  
      # Note that we cannot rely on '__origin__' in other type hints as it has changed from version
      # to version.
      origin = getattr(annotation, "__origin__", None)
      return origin == typing.Union and (
          parameter_check_func is None
          or all(map(parameter_check_func, annotation.__args__))
      )
  
file_path: spark/python/pyspark/sql/pandas/typehints.py
imports: from inspect import Signature
  from typing import Any, Callable, Dict, Optional, Union, TYPE_CHECKING
  from pyspark.sql.pandas.utils import require_minimum_pandas_version
  from pyspark.errors import PySparkNotImplementedError, PySparkValueError
label_desc: Use image node_id 4 for calling a global function with example usage: check_union_annotation(annotation, parameter_check_func) and returns: unknown