code: def _get_active_spark_session():
      try:
          from pyspark.sql import SparkSession
      except ImportError:
          # Return None if user doesn't have PySpark installed
          return None
      try:
          # getActiveSession() only exists in Spark 3.0 and above
          return SparkSession.getActiveSession()
      except Exception:
          # Fall back to this internal field for Spark 2.x and below.
          return SparkSession._instantiatedSession
  
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 1 for calling a global function with example usage: _get_active_spark_session() and returns: SparkSession, None, SparkSession