class_docstr: User defined function in Python
  
  .. versionadded:: 1.3
  
  Notes
  -----
  The constructor of this class is not supposed to be directly called.
  Use :meth:`pyspark.sql.functions.udf` or :meth:`pyspark.sql.functions.pandas_udf`
  to create this instance.
class_docstr_tok: ["User","defined","function","in","Python","..","versionadded",":",":","1.3","Notes","--","--","-","The","constructor","of","this","class","is","not","supposed","to","be","directly","called",".","Use",":","meth",":","`","pyspark.sql.functions.udf","`","or",":","meth",":","`","pyspark.sql.functions.pandas_udf","`","to","create","this","instance","."]
code: def _create_judf(self, func: Callable[..., Any]) -> JavaObject:
      from pyspark.sql import SparkSession
  
      spark = SparkSession._getActiveSessionOrCreate()
      sc = spark.sparkContext
  
      wrapped_func = _wrap_function(sc, func, self.returnType)
      jdt = spark._jsparkSession.parseDataType(self.returnType.json())
      assert sc._jvm is not None
      judf = sc._jvm.org.apache.spark.sql.execution.python.UserDefinedPythonFunction(
          self._name,
          wrapped_func,
          jdt,
          self.evalType,
          self.deterministic,
      )
      return judf
  
imports: from inspect import getfullargspec
  import functools
  import inspect
  import sys
  import warnings
  from typing import Callable, Any, TYPE_CHECKING, Optional, cast, Union
  from py4j.java_gateway import JavaObject
  from pyspark import SparkContext
  from pyspark.rdd import _prepare_for_python_RDD, PythonEvalType
  from pyspark.sql.column import Column, _to_java_expr, _to_seq
  from pyspark.sql.types import DataType, StringType, StructType, _parse_datatype_string
  from pyspark.sql.utils import get_active_spark_context
  from pyspark.sql.pandas.types import to_arrow_type
  from pyspark.sql.pandas.utils import require_minimum_pandas_version, require_minimum_pyarrow_version
  from pyspark.errors import PySparkTypeError, PySparkNotImplementedError, PySparkRuntimeError
label_desc: Use image node_id 4 for calling the UserDefinedFunction obj's underlying member method code with example usage: obj._create_judf(func) and returns: judf