code: def testModelSerialization():
      spark = test_helpers.getOrCreateSparkSession(
          test_helpers.getCurrentMethodName()
      )
      import catboost_spark
  
      featureNames = ["f1", "f2", "f3"]
  
      srcDataSchema = pool_test_helpers.createSchema(
          [("features", VectorUDT()), ("label", DoubleType())],
          featureNames,
          addFeatureNamesMetadata=True,
      )
  
      srcData = [
          Row(Vectors.dense(0.1, 0.2, 0.11), 1.0),
          Row(Vectors.dense(0.97, 0.82, 0.33), 2.0),
          Row(Vectors.dense(0.13, 0.22, 0.23), 2.0),
          Row(Vectors.dense(0.14, 0.18, 0.1), 1.0),
          Row(Vectors.dense(0.9, 0.67, 0.17), 2.0),
          Row(Vectors.dense(0.66, 0.1, 0.31), 1.0),
      ]
  
      df = spark.createDataFrame(
          spark.sparkContext.parallelize(srcData),
          StructType(srcDataSchema),
      )
  
      classifier = (
          catboost_spark.CatBoostClassifier()
          .setIterations(20)
          .setTrainDir(
              tempfile.mkdtemp(
                  prefix=test_helpers.getCurrentMethodName()
              )
          )
      )
      model = classifier.fit(df)
      predictions = model.transform(df)
  
      print("predictions")
      predictions.show(truncate=False)
  
      modelsDir = tempfile.mkdtemp(prefix="catboost_models_")
  
      nativeCatBoostModelPath = os.path.join(
          modelsDir, "binclass_model_on_df.cbm"
      )
      model.saveNativeModel(nativeCatBoostModelPath)
  
      loadedCatBoostModel = (
          catboost_spark.CatBoostClassificationModel.loadNativeModel(
              nativeCatBoostModelPath
          )
      )
      predictionsLoadedCatBoost = loadedCatBoostModel.transform(df)
      print("predictionsLoadedCatBoost")
      predictionsLoadedCatBoost.show(truncate=False)
  
      nativeJsonModelPath = os.path.join(
          modelsDir, "binclass_model_on_df.json"
      )
      model.saveNativeModel(
          nativeJsonModelPath, catboost_spark.EModelType.Json
      )
  
      nativeOnnxModelPath = os.path.join(
          modelsDir, "binclass_model_on_df.onnx"
      )
      model.saveNativeModel(
          nativeOnnxModelPath,
          catboost_spark.EModelType.Onnx,
          {
              "onnx_domain": "ai.catboost",
              "onnx_model_version": 1,
              "onnx_doc_string": "test model for classification",
              "onnx_graph_name": "CatBoostModel_for_classification",
          },
      )
  
      loadedOnnxModel = (
          catboost_spark.CatBoostClassificationModel.loadNativeModel(
              nativeOnnxModelPath, catboost_spark.EModelType.Onnx
          )
      )
      predictionsLoadedOnnx = loadedOnnxModel.transform(df)
      print("predictionsLoadedOnnx")
      predictionsLoadedOnnx.show(truncate=False)
  
      sparkModelPath = os.path.join(modelsDir, "binclass_model_on_df")
      model.write().overwrite().save(sparkModelPath)
      loadedModel = catboost_spark.CatBoostClassificationModel.load(
          sparkModelPath
      )
  
      predictionsLoaded = loadedModel.transform(df)
      print("predictionsLoaded")
      predictionsLoaded.show(truncate=False)
  
      shutil.rmtree(modelsDir)
  
imports: import collections
  import os
  import shutil
  import tempfile
  import test_helpers
  import pool_test_helpers
  from pyspark.ml import Pipeline, PipelineModel
  import pyspark.ml.evaluation
  from pyspark.ml.feature import StringIndexer, VectorAssembler
  from pyspark.ml.linalg import Vectors, VectorUDT
  import pyspark.ml.tuning
  from pyspark.sql import Row
  from pyspark.sql.types import *
label_desc: Use image node_id 8 for calling a global function with example usage: testModelSerialization() without return types