code: def add_libraries_to_model(
      model_uri, run_id=None, registered_model_name=None
  ):
      """
      Given a registered model_uri (e.g. models:/<model_name>/<model_version>), this utility
      re-logs the model along with all the required model libraries back to the Model Registry.
      The required model libraries are stored along with the model as model artifacts. In
      addition, supporting files to the model (e.g. conda.yaml, requirements.txt) are modified
      to use the added libraries.
  
      By default, this utility creates a new model version under the same registered model specified
      by ``model_uri``. This behavior can be overridden by specifying the ``registered_model_name``
      argument.
  
      :param model_uri: A registered model uri in the Model Registry of the form
                        models:/<model_name>/<model_version/stage/latest>
      :param run_id: The ID of the run to which the model with libraries is logged. If None, the model
                     with libraries is logged to the source run corresponding to model version
                     specified by ``model_uri``; if the model version does not have a source run, a
                     new run created.
      :param registered_model_name: The new model version (model with its libraries) is
                                    registered under the inputted registered_model_name. If None, a
                                    new version is logged to the existing model in the Model Registry.
  
      .. note::
          This utility only operates on a model that has been registered to the Model Registry.
  
      .. note::
          The libraries are only compatible with the platform on which they are added. Cross platform
          libraries are not supported.
  
      .. code-block:: python
          :caption: Example
  
          # Create and log a model to the Model Registry
  
          import pandas as pd
          from sklearn import datasets
          from sklearn.ensemble import RandomForestClassifier
          import mlflow
          import mlflow.sklearn
          from mlflow.models import infer_signature
  
          with mlflow.start_run():
              iris = datasets.load_iris()
              iris_train = pd.DataFrame(iris.data, columns=iris.feature_names)
              clf = RandomForestClassifier(max_depth=7, random_state=0)
              clf.fit(iris_train, iris.target)
              signature = infer_signature(iris_train, clf.predict(iris_train))
              mlflow.sklearn.log_model(
                  clf, "iris_rf", signature=signature, registered_model_name="model-with-libs"
              )
  
          # model uri for the above model
          model_uri = "models:/model-with-libs/1"
  
          # Import utility
          from mlflow.models.utils import add_libraries_to_model
  
          # Log libraries to the original run of the model
          add_libraries_to_model(model_uri)
  
          # Log libraries to some run_id
          existing_run_id = "21df94e6bdef4631a9d9cb56f211767f"
          add_libraries_to_model(model_uri, run_id=existing_run_id)
  
          # Log libraries to a new run
          with mlflow.start_run():
              add_libraries_to_model(model_uri)
  
          # Log libraries to a new registered model named 'new-model'
          with mlflow.start_run():
              add_libraries_to_model(model_uri, registered_model_name="new-model")
      """
      import mlflow
      from mlflow.models.wheeled_model import WheeledModel
  
      if mlflow.active_run() is None:
          if run_id is None:
              run_id = get_model_version_from_model_uri(
                  model_uri
              ).run_id
          with mlflow.start_run(run_id):
              return WheeledModel.log_model(
                  model_uri, registered_model_name
              )
      else:
          return WheeledModel.log_model(
              model_uri, registered_model_name
          )
  
imports: import datetime
  import decimal
  import json
  import logging
  import os
  from copy import deepcopy
  from typing import Any, Dict, List, Optional, Union
  import numpy
  import pandas
  from mlflow.exceptions import INVALID_PARAMETER_VALUE, MlflowException
  from mlflow.models import Model
  from mlflow.store.artifact.utils.models import get_model_name_and_version
  from mlflow.types import DataType, ParamSchema, ParamSpec, Schema, TensorSpec
  from mlflow.types.schema import Array, Object, Property
  from mlflow.types.utils import TensorsNotSupportedException, _infer_param_schema, clean_tensor_type
  from mlflow.utils.annotations import experimental
  from mlflow.utils.proto_json_utils import NumpyEncoder, dataframe_from_parsed_json, parse_tf_serving_input
  from mlflow.utils.uri import get_databricks_profile_uri_from_artifact_uri
label_desc: Use image node_id 21 for calling a global function with example usage: add_libraries_to_model(model_uri, run_id, registered_model_name) and returns: WheeledModel, WheeledModel