code: def __init__(self, target_metric, direction="min") -> None:
      super().__init__()
      self.target_metric = target_metric
      self.direction = direction
      self.best_score = None
  
imports: from typing import Any
  import torch
  import time
  from pytorch_lightning.callbacks import Callback
  from pytorch_lightning.loops.dataloader.evaluation_loop import EvaluationLoop
  from bigdl.nano.utils.common import invalidInputError
  from collections import ChainMap
  from torchmetrics import Metric
label_desc: Use image node_id 1 to create a new BestMetricCallback object from inherited base classes: Callback with example: obj = BestMetricCallback(target_metric, direction)