code: def _mml_py2java(sc, obj):
      """Convert Python object into Java"""
      if isinstance(obj, JavaParams):
          obj._transfer_params_to_java()
          obj = obj._java_obj
      elif isinstance(obj, PipelineModel):
          obj = obj._to_java()
      elif isinstance(obj, RDD):
          obj = _to_java_object_rdd(obj)
      elif isinstance(obj, DataFrame):
          obj = obj._jdf
      elif isinstance(obj, SparkContext):
          obj = obj._jsc
      elif isinstance(obj, list):
          obj = [_mml_py2java(sc, x) for x in obj]
      elif isinstance(obj, JavaObject):
          pass
      elif isinstance(obj, (int, float, bool, bytes, str)):
          pass
      elif isinstance(obj, DataType):
          obj = sc._jvm.org.apache.spark.sql.types.DataType.fromJson(
              obj.json()
          )
      else:
          data = bytearray(PickleSerializer().dumps(obj))
          obj = sc._jvm.org.apache.spark.ml.python.MLSerDe.loads(data)
      return obj
  
file_path: SynapseML/core/src/main/python/synapse/ml/core/serialize/java_params_patch.py
imports: from pyspark.ml.wrapper import JavaParams, JavaWrapper
  from py4j.java_gateway import JavaObject
  from pyspark import RDD, SparkContext
  from pyspark.serializers import PickleSerializer, AutoBatchedSerializer
  from pyspark.sql import DataFrame, SQLContext
  from pyspark.ml.common import _to_java_object_rdd, _java2py
  import pyspark
  from pyspark.ml import PipelineModel
  from pyspark.sql.types import DataType
label_desc: Use image node_id 2 for calling a global function with example usage: _mml_py2java(sc, obj) and returns: obj