class_docstr: Wrapper for user-defined function registration.
class_docstr_tok: ["Wrapper","for","user-defined","function","registration","."]
code: def register(
      self,
      name: str,
      f: Union[Callable[..., Any], "UserDefinedFunctionLike"],
      returnType: Optional["DataTypeOrString"] = None,
  ) -> "UserDefinedFunctionLike":
      # This is to check whether the input function is from a user-defined function or
      # Python function.
      if hasattr(f, "asNondeterministic"):
          if returnType is not None:
              raise PySparkTypeError(
                  error_class="CANNOT_SPECIFY_RETURN_TYPE_FOR_UDF",
                  message_parameters={
                      "arg_name": "f",
                      "return_type": str(returnType),
                  },
              )
          f = cast("UserDefinedFunctionLike", f)
          if f.evalType not in [
              PythonEvalType.SQL_BATCHED_UDF,
              PythonEvalType.SQL_ARROW_BATCHED_UDF,
              PythonEvalType.SQL_SCALAR_PANDAS_UDF,
              PythonEvalType.SQL_SCALAR_PANDAS_ITER_UDF,
              PythonEvalType.SQL_GROUPED_AGG_PANDAS_UDF,
          ]:
              raise PySparkTypeError(
                  error_class="INVALID_UDF_EVAL_TYPE",
                  message_parameters={
                      "eval_type": "SQL_BATCHED_UDF, SQL_ARROW_BATCHED_UDF, "
                      "SQL_SCALAR_PANDAS_UDF, SQL_SCALAR_PANDAS_ITER_UDF or "
                      "SQL_GROUPED_AGG_PANDAS_UDF"
                  },
              )
          self.sparkSession._client.register_udf(
              f.func, f.returnType, name, f.evalType, f.deterministic
          )
          return f
      else:
          if returnType is None:
              returnType = StringType()
          py_udf = _create_udf(
              f,
              returnType=returnType,
              evalType=PythonEvalType.SQL_BATCHED_UDF,
              name=name,
          )
  
          self.sparkSession._client.register_udf(
              py_udf.func, returnType, name
          )
          return py_udf
  
imports: from pyspark.sql.connect.utils import check_dependencies
  import sys
  import functools
  import warnings
  from inspect import getfullargspec
  from typing import cast, Callable, Any, List, TYPE_CHECKING, Optional, Union
  from pyspark.rdd import PythonEvalType
  from pyspark.sql.connect.expressions import ColumnReference, CommonInlineUserDefinedFunction, Expression, NamedArgumentExpression, PythonUDF
  from pyspark.sql.connect.column import Column
  from pyspark.sql.connect.types import UnparsedDataType
  from pyspark.sql.types import DataType, StringType
  from pyspark.sql.udf import UDFRegistration
  from pyspark.errors import PySparkTypeError, PySparkRuntimeError
label_desc: Use image node_id 2 for calling the UDFRegistration obj's underlying member method code with example usage: obj.register(name, f, returnType) and returns: f, py_udf