code: def is_better(score, current_score, direction):
      if current_score is None:
          return True
      elif direction == "minimize" or direction == "min":
          if score < current_score:
              return True
          return False
      else:
          if score < current_score:
              return False
          return True
  
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 for calling a global function with example usage: is_better(score, current_score, direction) and returns: True, False, True, True, False