code: def prepare_monitoring(cf):
      """
      creates dictionaries, where train/val metrics are stored.
      """
      metrics = {}
      # first entry for loss dict accounts for epoch starting at 1.
      metrics["train"] = OrderedDict()
      metrics["val"] = OrderedDict()
      metric_classes = []
      if "rois" in cf.report_score_level:
          metric_classes.extend([v for k, v in cf.class_dict.items()])
      if "patient" in cf.report_score_level:
          metric_classes.extend(["patient"])
      for cl in metric_classes:
          metrics["train"][cl + "_ap"] = [None]
          metrics["val"][cl + "_ap"] = [None]
          if cl == "patient":
              metrics["train"][cl + "_auc"] = [None]
              metrics["val"][cl + "_auc"] = [None]
  
      metrics["train"]["monitor_values"] = [
          [] for _ in range(cf.num_epochs + 1)
      ]
      metrics["val"]["monitor_values"] = [
          [] for _ in range(cf.num_epochs + 1)
      ]
  
      # generate isntance of monitor plot class.
      TrainingPlot = plotting.TrainingPlot_2Panel(cf)
  
      return metrics, TrainingPlot
  
imports: import numpy
  import logging
  import subprocess
  import os
  import torch
  from collections import OrderedDict
  import plotting
  import sys
  import importlib.util
  import pandas
  import pickle
label_desc: Use image node_id 5 for calling a global function with example usage: prepare_monitoring(cf) and returns: metrics,  TrainingPlot