code: def stopping_fn_from_loss() -> Callable[[Engine], Any]:
      """
      Returns a stopping function for ignite.handlers.EarlyStopping using the loss value.
      """
  
      def stopping_fn(engine: Engine) -> Any:
          return -engine.state.output  # type:ignore
  
      return stopping_fn
  
file_path: MONAI/monai/handlers/utils.py
imports: from __future__ import annotations
  import os
  from collections import OrderedDict
  from collections.abc import Callable, Sequence
  from typing import TYPE_CHECKING, Any
  import numpy
  import torch
  from monai.config import IgniteInfo, KeysCollection, PathLike
  from monai.utils import ensure_tuple, look_up_option, min_version, optional_import
label_desc: Use image node_id 2 for calling a global function with example usage: stopping_fn_from_loss() and returns: stopping_fn, unknown