code: def log_end_epoch_stats(trainer, progress, extra_meters):
      stats = get_training_stats(trainer)
      for k, meter in extra_meters.items():
          stats[k] = meter.avg
      progress.print(stats)
      return stats
  
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 2 for calling a global function with example usage: log_end_epoch_stats(trainer, progress, extra_meters) and returns: stats