code: def load_model(
      model_name: str,
      platform: Optional[str] = None,
      authentication: Optional[Dict[str, str]] = None,
      verbose: bool = True,
  ):
      """
      This generic function loads a previously saved transformation pipeline and model
      from the current active directory into the current python environment.
      Load object must be a pickle file.
  
      Parameters
      ----------
      model_name : str, default = none
          Name of pickle file to be passed as a string.
  
      platform: str, default = None
          Name of platform, if loading model from cloud. Current available options are:
          'aws', 'gcp' and 'azure'.
  
      authentication : dict
          dictionary of applicable authentication tokens.
  
          When platform = 'aws':
          {'bucket' : 'Name of Bucket on S3', 'path': (optional) folder name under the bucket}
  
          When platform = 'gcp':
          {'project': 'gcp_pycaret', 'bucket' : 'pycaret-test'}
  
          When platform = 'azure':
          {'container': 'pycaret-test'}
  
      verbose: bool, default = True
          Success message is not printed when verbose is set to False.
  
      Returns
      -------
      Model Object
  
      """
  
      function_params_str = ", ".join(
          [f"{k}={v}" for k, v in locals().items()]
      )
  
      logger = get_logger()
  
      logger.info("Initializing load_model()")
      logger.info(f"load_model({function_params_str})")
  
      # exception checking
  
      if platform:
          if not authentication:
              raise ValueError("Authentication is missing.")
  
      if not platform:
          model_name = f"{model_name}.pkl"
          model = joblib.load(model_name)
          if verbose:
              print(
                  "Transformation Pipeline and Model Successfully Loaded"
              )
          return model
  
      # cloud providers
      elif platform == "aws":
          import os
  
          # checking if boto3 is available
          _check_soft_dependencies(
              "boto3", extra=None, severity="error"
          )
          import boto3
  
          bucketname = authentication.get("bucket")
  
          if bucketname is None:
              logger.error(
                  "S3 bucket name missing. Provide `bucket` as part of authentication parameter"
              )
              raise ValueError(
                  "S3 bucket name missing. Provide `bucket` name as part of authentication parameter"
              )
  
          filename = f"{model_name}.pkl"
  
          if "path" in authentication:
              key = os.path.join(authentication.get("path"), filename)
          else:
              key = filename
  
          index = filename.rfind("/")
          s3 = boto3.resource("s3")
  
          if index == -1:
              s3.Bucket(bucketname).download_file(key, filename)
          else:
              path, key = filename[: index + 1], filename[index + 1 :]
              if not os.path.exists(path):
                  os.makedirs(path)
              s3.Bucket(bucketname).download_file(key, filename)
  
          model = load_model(model_name, verbose=False)
  
          if verbose:
              print(
                  "Transformation Pipeline and Model Successfully Loaded"
              )
  
          return model
  
      elif platform == "gcp":
          bucket_name = authentication.get("bucket")
          project_name = authentication.get("project")
  
          if bucket_name is None or project_name is None:
              logger.error(
                  "Project and Bucket name missing. Provide `bucket` and `project` as part of "
                  "authentication parameter"
              )
              raise ValueError(
                  "Project and Bucket name missing. Provide `bucket` and `project` as part of "
                  "authentication parameter"
              )
  
          filename = f"{model_name}.pkl"
  
          _download_blob_gcp(
              project_name, bucket_name, filename, filename
          )
  
          model = load_model(model_name, verbose=False)
  
          if verbose:
              print(
                  "Transformation Pipeline and Model Successfully Loaded"
              )
          return model
  
      elif platform == "azure":
          container_name = authentication.get("container")
  
          if container_name is None:
              logger.error(
                  "Storage Container name missing. Provide `container` as part of authentication parameter"
              )
              raise ValueError(
                  "Storage Container name missing. Provide `container` as part of authentication parameter"
              )
  
          filename = f"{model_name}.pkl"
  
          _download_blob_azure(container_name, filename, filename)
  
          model = load_model(model_name, verbose=False)
  
          if verbose:
              print(
                  "Transformation Pipeline and Model Successfully Loaded"
              )
          return model
      else:
          print(
              f"Platform {platform} is not supported by pycaret or illegal option"
          )
      gc.collect()
  
file_path: pycaret/pycaret/internal/persistence.py
imports: import gc
  import os
  from typing import Dict, Optional
  import joblib
  from sklearn.pipeline import Pipeline
  from pycaret.utils._dependencies import _check_soft_dependencies
  from pycaret.utils.generic import MLUsecase, get_logger
label_desc: Use image node_id 3 for calling a global function with example usage: load_model(model_name, platform, authentication, verbose) and returns: model, model, model, model