code: def test_sort_epochs():
      mode = "min"
      reporter = Reporter()
      key1 = uuid.uuid4().hex
      stats_list = [{"aa": 0.3}, {"aa": 0.5}, {"aa": 0.2}]
      for e in range(len(stats_list)):
          reporter.set_epoch(e + 1)
          with reporter.observe(key1) as sub:
              sub.register(stats_list[e])
              sub.next()
      sort_values = reporter.sort_epochs(key1, "aa", mode)
  
      desired = sorted(
          [
              (e + 1, stats_list[e]["aa"])
              for e in range(len(stats_list))
          ],
          key=lambda x: x[1],
      )
  
      for e in range(len(stats_list)):
          assert sort_values[e] == desired[e][0]
  
imports: import logging
  import uuid
  from pathlib import Path
  import numpy
  import pytest
  import torch
  from torch.utils.tensorboard import SummaryWriter
  from espnet2.train.reporter import Average, ReportedValue, Reporter, aggregate
label_desc: Use image node_id 6 for calling a global function with example usage: test_sort_epochs() without return types