code: def _read_metric(metric_name, stdout):
      log = stdout.getvalue()
      metric_log = [
          line for line in log.split("\n") if metric_name in line
      ][-1]
      return float(metric_log.strip().split(" ")[-1])
  
file_path: trax/trax/supervised/mnist_test.py
imports: import io
  import itertools
  from unittest import mock
  from absl.testing import absltest
  from trax import layers
  from trax.data import inputs
  from trax.data import tf_inputs
  from trax.optimizers import adam
  from trax.supervised import training
label_desc: Use image node_id 5 for calling a global function with example usage: _read_metric(metric_name, stdout) and returns: float