code: def load_model(model_uri, dfs_tmpdir=None, dst_path=None):
      """
      Load the Spark MLlib model from the path.
  
      :param model_uri: The location, in URI format, of the MLflow model, for example:
  
                        - ``/Users/me/path/to/local/model``
                        - ``relative/path/to/local/model``
                        - ``s3://my_bucket/path/to/model``
                        - ``runs:/<mlflow_run_id>/run-relative/path/to/model``
                        - ``models:/<model_name>/<model_version>``
                        - ``models:/<model_name>/<stage>``
  
                        For more information about supported URI schemes, see
                        `Referencing Artifacts <https://www.mlflow.org/docs/latest/concepts.html#
                        artifact-locations>`_.
      :param dfs_tmpdir: Temporary directory path on Distributed (Hadoop) File System (DFS) or local
                         filesystem if running in local mode. The model is loaded from this
                         destination. Defaults to ``/tmp/mlflow``.
      :param dst_path: The local filesystem path to which to download the model artifact.
                       This directory must already exist. If unspecified, a local output
                       path will be created.
      :return: pyspark.ml.pipeline.PipelineModel
  
      .. code-block:: python
          :caption: Example
  
          from mlflow import spark
  
          model = mlflow.spark.load_model("spark-model")
          # Prepare test documents, which are unlabeled (id, text) tuples.
          test = spark.createDataFrame(
              [(4, "spark i j k"), (5, "l m n"), (6, "spark hadoop spark"), (7, "apache hadoop")],
              ["id", "text"],
          )
          # Make predictions on test documents
          prediction = model.transform(test)
      """
      # This MUST be called prior to appending the model flavor to `model_uri` in order
      # for `artifact_path` to take on the correct value for model loading via mlflowdbfs.
      root_uri, artifact_path = _get_root_uri_and_artifact_path(
          model_uri
      )
  
      flavor_conf = _get_flavor_configuration_from_uri(
          model_uri, FLAVOR_NAME, _logger
      )
      local_mlflow_model_path = _download_artifact_from_uri(
          artifact_uri=model_uri, output_path=dst_path
      )
      _add_code_from_conf_to_system_path(
          local_mlflow_model_path, flavor_conf
      )
  
      model_class = flavor_conf.get("model_class")
      if model_class is not None and model_class.startswith(
          "pyspark.ml.connect."
      ):
          spark_model_local_path = os.path.join(
              local_mlflow_model_path, flavor_conf["model_data"]
          )
          return _load_spark_connect_model(
              model_class, spark_model_local_path
          )
  
      if _should_use_mlflowdbfs(model_uri):
          from pyspark.ml.pipeline import PipelineModel
  
          mlflowdbfs_path = _mlflowdbfs_path(
              DatabricksArtifactRepository._extract_run_id(model_uri),
              artifact_path,
          )
          with databricks_utils.MlflowCredentialContext(
              get_databricks_profile_uri_from_artifact_uri(root_uri)
          ):
              return PipelineModel.load(mlflowdbfs_path)
  
      sparkml_model_uri = append_to_uri_path(
          model_uri, flavor_conf["model_data"]
      )
      local_sparkml_model_path = os.path.join(
          local_mlflow_model_path, flavor_conf["model_data"]
      )
      return _load_model(
          model_uri=sparkml_model_uri,
          dfs_tmpdir_base=dfs_tmpdir,
          local_model_path=local_sparkml_model_path,
      )
  
imports: import logging
  import os
  import posixpath
  import re
  import shutil
  from typing import Any, Dict, Optional
  import pandas
  import yaml
  from packaging.version import Version
  import mlflow
  from mlflow import environment_variables, mleap, pyfunc
  from mlflow.environment_variables import MLFLOW_DFS_TMP
  from mlflow.exceptions import MlflowException
  from mlflow.models import Model, ModelInputExample, ModelSignature, infer_signature
  from mlflow.models.model import MLMODEL_FILE_NAME
  from mlflow.models.signature import _LOG_MODEL_INFER_SIGNATURE_WARNING_TEMPLATE
  from mlflow.models.utils import _Example, _save_example
  from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE
  from mlflow.store.artifact.databricks_artifact_repo import DatabricksArtifactRepository
  from mlflow.tracking._model_registry import DEFAULT_AWAIT_MAX_SLEEP_SECONDS
  from mlflow.tracking.artifact_utils import _download_artifact_from_uri, _get_root_uri_and_artifact_path
  from mlflow.utils import _get_fully_qualified_class_name, databricks_utils
  from mlflow.utils.autologging_utils import autologging_integration, safe_patch
  from mlflow.utils.class_utils import _get_class_from_string
  from mlflow.utils.docstring_utils import LOG_MODEL_PARAM_DOCS, format_docstring
  from mlflow.utils.environment import _CONDA_ENV_FILE_NAME, _CONSTRAINTS_FILE_NAME, _PYTHON_ENV_FILE_NAME, _REQUIREMENTS_FILE_NAME, _mlflow_conda_env, _process_conda_env, _process_pip_requirements, _PythonEnv, _validate_env_arguments
  from mlflow.utils.file_utils import TempDir, get_total_file_size, shutil_copytree_without_file_permissions, write_to
  from mlflow.utils.model_utils import _add_code_from_conf_to_system_path, _get_flavor_configuration_from_uri, _validate_and_copy_code_paths
  from mlflow.utils.requirements_utils import _get_pinned_requirement
  from mlflow.utils.uri import append_to_uri_path, dbfs_hdfs_uri_to_fuse_path, generate_tmp_dfs_path, get_databricks_profile_uri_from_artifact_uri, is_databricks_acled_artifacts_uri, is_local_uri, is_valid_dbfs_uri
label_desc: Use image node_id 14 for calling a global function with example usage: load_model(model_uri, dfs_tmpdir, dst_path) and returns: _load_model, _load_spark_connect_model, PipelineModel