code: def test_get_repl_id():
      # Outside of Databricks environments, the Databricks REPL ID should be absent
      assert databricks_utils.get_repl_id() is None
  
      mock_dbutils = mock.MagicMock()
      mock_dbutils.entry_point.getReplId.return_value = "testReplId1"
      with mock.patch(
          "mlflow.utils.databricks_utils._get_dbutils",
          return_value=mock_dbutils,
      ):
          assert databricks_utils.get_repl_id() == "testReplId1"
  
      mock_sparkcontext_inst = mock.MagicMock()
      mock_sparkcontext_inst.getLocalProperty.return_value = (
          "testReplId2"
      )
      mock_sparkcontext_class = mock.MagicMock()
      mock_sparkcontext_class.getOrCreate.return_value = (
          mock_sparkcontext_inst
      )
      mock_spark = mock.MagicMock()
      mock_spark.SparkContext = mock_sparkcontext_class
  
      original_import = builtins.__import__
  
      def mock_import(name, *args, **kwargs):
          if name == "pyspark":
              return mock_spark
          else:
              return original_import(name, *args, **kwargs)
  
      with mock.patch("builtins.__import__", side_effect=mock_import):
          assert databricks_utils.get_repl_id() == "testReplId2"
  
imports: import builtins
  import sys
  from unittest import mock
  import pytest
  from databricks_cli.configure.provider import DatabricksConfig
  from mlflow.exceptions import MlflowException
  from mlflow.utils import databricks_utils
  from mlflow.utils.databricks_utils import check_databricks_secret_scope_access, get_mlflow_credential_context_by_run_id, get_workspace_info_from_databricks_secrets, get_workspace_info_from_dbutils, is_databricks_default_tracking_uri, is_running_in_ipython_environment
  from mlflow.utils.uri import construct_db_uri_from_profile
  from tests.helper_functions import mock_method_chain
label_desc: Use image node_id 17 for calling a global function with example usage: test_get_repl_id() and returns: mock_spark, original_import