code: def _test() -> None:
      import doctest
      from pyspark.sql import SparkSession
  
      globs = globals().copy()
      # The small batch size here ensures that we see multiple batches,
      # even in these small test examples:
      spark = (
          SparkSession.builder.master("local[2]")
          .appName("mllib.util tests")
          .getOrCreate()
      )
      globs["spark"] = spark
      globs["sc"] = spark.sparkContext
      (failure_count, test_count) = doctest.testmod(
          globs=globs, optionflags=doctest.ELLIPSIS
      )
      spark.stop()
      if failure_count:
          sys.exit(-1)
  
imports: import sys
  from functools import reduce
  import numpy
  from pyspark import SparkContext, since
  from pyspark.mllib.common import callMLlibFunc, inherit_doc
  from pyspark.mllib.linalg import Vectors, SparseVector, _convert_to_vector
  from pyspark.sql import DataFrame
  from typing import Generic, Iterable, List, Optional, Tuple, Type, TypeVar, cast, TYPE_CHECKING
  from pyspark.context import SparkContext
  from pyspark.mllib.linalg import Vector
  from pyspark.rdd import RDD
  from pyspark.sql.dataframe import DataFrame
label_desc: Use image node_id 1 for calling a global function with example usage: _test() without return types