code: def _log_early_stop_metrics(early_stop_callback, client, run_id):
      """
      Logs early stopping behavior results (e.g. stopped epoch) as metrics to MLflow.
  
      :param early_stop_callback: The early stopping callback instance used during training.
      :param client: An `MlflowAutologgingQueueingClient` instance used for MLflow logging.
      :param run_id: The ID of the MLflow Run to which to log configuration parameters.
      """
      if early_stop_callback.stopped_epoch == 0:
          return
  
      metrics = {
          "stopped_epoch": early_stop_callback.stopped_epoch,
          "restored_epoch": early_stop_callback.stopped_epoch
          - max(1, early_stop_callback.patience),
      }
  
      if hasattr(early_stop_callback, "best_score"):
          metrics["best_score"] = float(early_stop_callback.best_score)
  
      if hasattr(early_stop_callback, "wait_count"):
          metrics["wait_count"] = early_stop_callback.wait_count
  
      client.log_metrics(run_id, metrics)
  
imports: import logging
  import os
  import tempfile
  import warnings
  from packaging.version import Version
  import mlflow.pytorch
  from mlflow.exceptions import MlflowException
  from mlflow.ml_package_versions import _ML_PACKAGE_VERSIONS
  from mlflow.pytorch import _pytorch_autolog
  from mlflow.utils.autologging_utils import BatchMetricsLogger, ExceptionSafeAbstractClass, MlflowAutologgingQueueingClient, get_autologging_config
  import pytorch_lightning
  from pytorch_lightning.utilities import rank_zero_only
label_desc: Use image node_id 3 for calling a global function with example usage: _log_early_stop_metrics(early_stop_callback, client, run_id) without return types