code: def _create_local_spark_session_for_loading_spark_model():
      from pyspark.sql import SparkSession
  
      return (
          SparkSession.builder.config(
              "spark.python.worker.reuse", "true"
          )
          # The config is a workaround for avoiding databricks delta cache issue when loading
          # some specific model such as ALSModel.
          .config("spark.databricks.io.cache.enabled", "false")
          # In Spark 3.1 and above, we need to set this conf explicitly to enable creating
          # a SparkSession on the workers
          .config("spark.executor.allowSparkContext", "true")
          # Binding "spark.driver.bindAddress" to 127.0.0.1 helps avoiding some local hostname
          # related issues (e.g. https://github.com/mlflow/mlflow/issues/5733).
          .config("spark.driver.bindAddress", "127.0.0.1")
          .config("spark.executor.allowSparkContext", "true")
          .config(
              "spark.driver.extraJavaOptions",
              "-Dlog4j.configuration=file:/usr/local/spark/conf/log4j.properties",
          )
          .master("local[1]")
          .getOrCreate()
      )
  
file_path: mlflow/mlflow/utils/_spark_utils.py
imports: import contextlib
  import os
  import shutil
  import tempfile
  import zipfile
label_desc: Use image node_id 4 for calling a global function with example usage: _create_local_spark_session_for_loading_spark_model() and returns: SparkSession