code: def _monitors(proto, default_context, networks, datasets):
      class Monitor:
          pass
  
      monitors = OrderedDict()
  
      for m in proto.monitor:
          monitor = Monitor()
  
          monitor.network = networks[m.network_name]
  
          # for debugging
          monitor.net_variables = monitor.network.variables
  
          monitor.data_iterators = OrderedDict()
          for d in m.dataset_name:
              monitor.data_iterators[d] = datasets[d].data_iterator
  
          monitor.dataset_assign = OrderedDict()
          for d in m.data_variable:
              monitor.dataset_assign[
                  monitor.network.variables[d.variable_name]
              ] = d.data_name
  
          monitor.generator_assign = OrderedDict()
          for g in m.generator_variable:
              monitor.generator_assign[
                  monitor.network.variables[g.variable_name]
              ] = _get_generator(g)
  
          monitor.monitor_variables = []
          for e in m.monitor_variable:
              monitor.monitor_variables.append(
                  monitor.network.variables[e.variable_name]
              )
  
          monitor.forward_sequence = (
              monitor.network.get_forward_sequence(
                  monitor.monitor_variables
              )
          )
  
          monitors[m.name] = monitor
  
      return monitors
  
imports: from collections import OrderedDict
  import google.protobuf.text_format
  import itertools
  import numpy
  import os
  import re
  import shutil
  import tempfile
  from nnabla.initializer import NormalInitializer, UniformInitializer, ConstantInitializer, RangeInitializer, calc_normal_std_he_forward, calc_normal_std_he_backward, calc_normal_std_glorot, calc_uniform_lim_glorot
  from nnabla.logger import logger
  from nnabla.parameter import get_parameter_or_create
  from nnabla.utils import nnabla_pb2
  from nnabla.utils.data_iterator import data_iterator_csv_dataset, data_iterator_cache
  from nnabla.utils.create_cache import CreateCache
  from nnabla.utils.load_function import _create_function_instance
  from nnabla.utils.nnp_format import nnp_version
  from nnabla.utils.communicator_util import current_communicator, single_or_rankzero
  from nnabla.utils.learning_rate_scheduler import PolynomialScheduler, CosineScheduler, ExponentialScheduler, StepScheduler, LinearWarmupScheduler
  from legacy_network import Network
  from nnabla.utils.progress import progress
  from legacy_get_file_handle import get_file_handle_load, get_buf_type
  import nnabla
  import nnabla.function
  import nnabla.solver
label_desc: Use image node_id 16 for calling a global function with example usage: _monitors(proto, default_context, networks, datasets) and returns: monitors