code: def _validate_udtf_handler(
      cls: Any, returnType: Optional[Union[StructType, str]]
  ) -> None:
      """Validate the handler class of a UDTF."""
  
      if not isinstance(cls, type):
          raise PySparkTypeError(
              error_class="INVALID_UDTF_HANDLER_TYPE",
              message_parameters={"type": type(cls).__name__},
          )
  
      if not hasattr(cls, "eval"):
          raise PySparkAttributeError(
              error_class="INVALID_UDTF_NO_EVAL",
              message_parameters={"name": cls.__name__},
          )
  
      has_analyze = hasattr(cls, "analyze")
      has_analyze_staticmethod = has_analyze and isinstance(
          inspect.getattr_static(cls, "analyze"), staticmethod
      )
      if returnType is None and not has_analyze_staticmethod:
          raise PySparkAttributeError(
              error_class="INVALID_UDTF_RETURN_TYPE",
              message_parameters={"name": cls.__name__},
          )
      if returnType is not None and has_analyze:
          raise PySparkAttributeError(
              error_class="INVALID_UDTF_BOTH_RETURN_TYPE_AND_ANALYZE",
              message_parameters={"name": cls.__name__},
          )
  
imports: import pickle
  from dataclasses import dataclass, field
  import inspect
  import sys
  import warnings
  from typing import Any, Type, TYPE_CHECKING, Optional, Sequence, Union
  from py4j.java_gateway import JavaObject
  from pyspark.errors import PySparkAttributeError, PySparkPicklingError, PySparkTypeError
  from pyspark.rdd import PythonEvalType
  from pyspark.sql.column import _to_java_column, _to_java_expr, _to_seq
  from pyspark.sql.pandas.utils import require_minimum_pandas_version, require_minimum_pyarrow_version
  from pyspark.sql.types import DataType, StructType, _parse_datatype_string
  from pyspark.sql.udf import _wrap_function
label_desc: Use image node_id 3 for calling a global function with example usage: _validate_udtf_handler(cls, returnType) without return types