code: def is_training_over_time_limit(
      extra_state: Dict[str, Any], stop_time: float
  ) -> bool:
      elapsed_hr = (
          time.time()
          - extra_state["start_time"]
          + extra_state["previous_training_time"]
      ) / (60 * 60)
      if stop_time >= 0 and elapsed_hr > stop_time:
          print(
              f"Stopping training due to stop time limit of {stop_time} hours - "
              f"we've trained for {elapsed_hr} hours."
          )
          return True
      return False
  
file_path: translate/pytorch_translate/evals.py
imports: import math
  import time
  from collections import defaultdict, OrderedDict
  from typing import Any, Dict, List, Optional, Tuple
  from fairseq import distributed_utils, progress_bar, utils
  from fairseq.meters import AverageMeter
  from pytorch_translate import checkpoint, generate, utils
  from pytorch_translate.dual_learning.dual_learning_task import DualLearningTask
  from pytorch_translate.tasks.pytorch_translate_multi_task import PyTorchTranslateMultiTask
label_desc: Use image node_id 7 for calling a global function with example usage: is_training_over_time_limit(extra_state, stop_time) and returns: False, True