code: def log_model(
      diviner_model,
      artifact_path,
      conda_env=None,
      code_paths=None,
      registered_model_name=None,
      signature: ModelSignature = None,
      input_example: ModelInputExample = None,
      await_registration_for=DEFAULT_AWAIT_MAX_SLEEP_SECONDS,
      pip_requirements=None,
      extra_pip_requirements=None,
      metadata=None,
      **kwargs,
  ):
      """Log a ``Diviner`` object as an MLflow artifact for the current run.
  
      Args:
          diviner_model: ``Diviner`` model that has been ``fit`` on a grouped temporal ``DataFrame``.
          artifact_path: Run-relative artifact path to save the model instance to.
          conda_env: {{ conda_env }}
          code_paths: A list of local filesystem paths to Python file dependencies (or directories
              containing file dependencies). These files are *prepended* to the system
              path when the model is loaded.
          registered_model_name: This argument may change or be removed in a
              future release without warning. If given, create a model
              version under ``registered_model_name``, also creating a
              registered model if one with the given name does not exist.
          signature: :py:class:`Model Signature <mlflow.models.ModelSignature>` describes model
              input and output :py:class:`Schema <mlflow.types.Schema>`. The model
              signature can be :py:func:`inferred <mlflow.models.infer_signature>`
              from datasets with valid model input (e.g. the training dataset with target
              column omitted) and valid model output (e.g. model predictions generated on
              the training dataset), for example:
  
              .. code-block:: python
                :caption: Example
  
                from mlflow.models import infer_signature
  
                auto_arima_obj = AutoARIMA(out_of_sample_size=60, maxiter=100)
                base_auto_arima = GroupedPmdarima(model_template=auto_arima_obj).fit(
                    df=training_data,
                    group_key_columns=("region", "state"),
                    y_col="y",
                    datetime_col="ds",
                    silence_warnings=True,
                )
                predictions = model.predict(n_periods=30, alpha=0.05, return_conf_int=True)
                signature = infer_signature(data, predictions)
  
          input_example: {{ input_example }}
          await_registration_for: Number of seconds to wait for the model version
              to finish being created and is in ``READY`` status.
              By default, the function waits for five minutes.
              Specify 0 or None to skip waiting.
          pip_requirements: {{ pip_requirements }}
          extra_pip_requirements: {{ extra_pip_requirements }}
          metadata: Custom metadata dictionary passed to the model and stored in the MLmodel file.
  
              .. Note:: Experimental: This parameter may change or be removed in a future
                  release without warning.
  
          kwargs: Additional arguments for :py:class:`mlflow.models.model.Model`
              Additionally, for models that have been fit in Spark, the following supported
              configuration options are available to set.
              Current supported options:
              - `partition_by` for setting a (or several) partition columns as a list of \
              column names. Must be a list of strings of grouping key column(s).
              - `partition_count` for setting the number of part files to write from a \
              repartition per `partition_by` group. The default part file count is 200.
              - `dfs_tmpdir` for specifying the DFS temporary location where the model will \
              be stored while copying from a local file system to a Spark-supported "dbfs:/" \
              scheme.
  
      Returns:
          A :py:class:`ModelInfo <mlflow.models.model.ModelInfo>` instance that contains the
          metadata of the logged model.
      """
  
      return Model.log(
          artifact_path=artifact_path,
          flavor=mlflow.diviner,
          registered_model_name=registered_model_name,
          diviner_model=diviner_model,
          conda_env=conda_env,
          code_paths=code_paths,
          signature=signature,
          input_example=input_example,
          await_registration_for=await_registration_for,
          pip_requirements=pip_requirements,
          extra_pip_requirements=extra_pip_requirements,
          metadata=metadata,
          **kwargs,
      )
  
imports: import logging
  import os
  import pathlib
  import shutil
  from typing import Any, Dict, List, Optional, Tuple
  import pandas
  import yaml
  import mlflow
  from mlflow import pyfunc
  from mlflow.environment_variables import MLFLOW_DFS_TMP
  from mlflow.exceptions import MlflowException
  from mlflow.models import Model, ModelInputExample, ModelSignature
  from mlflow.models.model import MLMODEL_FILE_NAME
  from mlflow.models.utils import _save_example
  from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE
  from mlflow.tracking._model_registry import DEFAULT_AWAIT_MAX_SLEEP_SECONDS
  from mlflow.tracking.artifact_utils import _download_artifact_from_uri
  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 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, _get_flavor_configuration_from_uri, _validate_and_copy_code_paths, _validate_and_prepare_target_save_path
  from mlflow.utils.requirements_utils import _get_pinned_requirement
  from mlflow.utils.uri import dbfs_hdfs_uri_to_fuse_path, generate_tmp_dfs_path
label_desc: Use image node_id 9 for calling a global function with example usage: log_model(diviner_model, artifact_path, conda_env, code_paths, registered_model_name, signature, input_example, await_registration_for, pip_requirements, extra_pip_requirements, metadata) and returns: Model