code: def get_metric(self_tag, state, metric_key):
      if (
          torchbearer.DATA in state
          and state[torchbearer.DATA] == "test_data"
          and "val_" in metric_key
      ):
          return None
  
      if metric_key in state[torchbearer.METRICS]:
          return state[torchbearer.METRICS][metric_key]
      else:
          warnings.warn(
              "{}: Failed to retrieve key `{}` from metrics. ".format(
                  self_tag, metric_key
              )
          )
  
imports: import functools
  import traceback
  import warnings
  import torch
  from packaging import version
  import torchbearer
  import sys
label_desc: Use image node_id 9 for calling a global function with example usage: get_metric(_tag, state, metric_key) and returns: None, state