code: def create_proto(
      contents,
      include_params=False,
      variable_batch_size=True,
      save_solver_in_proto=False,
  ):
      class Context:
          pass
  
      proto = nnabla_pb2.NNablaProtoBuf()
      if "global_config" in contents:
          proto.global_config.MergeFrom(
              _create_global_config(
                  contents["global_config"]["default_context"]
              )
          )
      if "training_config" in contents:
          proto.training_config.MergeFrom(
              _create_training_config(
                  contents["training_config"]["max_epoch"],
                  contents["training_config"]["iter_per_epoch"],
                  contents["training_config"]["save_best"],
              )
          )
      ctx = Context()
      ctx.proto_graphs = {}
      networks = {}
      if "networks" in contents:
          proto_nets = []
          for net in contents["networks"]:
              networks[net["name"]] = _create_network(
                  ctx, net, variable_batch_size
              )
              proto_nets.append(networks[net["name"]])
          proto.network.extend(proto_nets)
      ctx.networks = networks
      datasets = {}
      if "datasets" in contents:
          proto_datasets = []
          for d in contents["datasets"]:
              if "cache_dir" in d:
                  cache_dir = d["cache_dir"]
              else:
                  cache_dir = None
              datasets[d["name"]] = _create_dataset(
                  d["name"],
                  d["uri"],
                  cache_dir,
                  d["variables"],
                  d["shuffle"],
                  d["batch_size"],
                  d["no_image_normalization"],
              )
              proto_datasets.append(datasets[d["name"]])
          proto.dataset.extend(proto_datasets)
      ctx.datasets = datasets
      if "optimizers" in contents:
          proto_optimizers = []
          for o in contents["optimizers"]:
              proto_optimizers.append(
                  _create_optimizer(ctx, o, save_solver_in_proto)
              )
          proto.optimizer.extend(proto_optimizers)
      if "monitors" in contents:
          proto_monitors = []
          for m in contents["monitors"]:
              proto_monitors.append(_create_monitor(ctx, m))
          proto.monitor.extend(proto_monitors)
      if "executors" in contents:
          proto_executors = []
          for e in contents["executors"]:
              proto_executors.append(_create_executor(ctx, e))
          proto.executor.extend(proto_executors)
  
      if include_params:
          params = get_parameters(grad_only=False)
          for variable_name, variable in params.items():
              parameter = proto.parameter.add()
              parameter.variable_name = variable_name
              parameter.shape.dim.extend(variable.shape)
              parameter.data.extend(
                  numpy.array(variable.d).flatten().tolist()
              )
              parameter.need_grad = variable.need_grad
  
      return proto
  
file_path: nnabla/python/src/nnabla/utils/save.py
imports: import os
  import re
  import types
  import nnabla
  import numpy
  from collections import OrderedDict
  from nnabla.logger import logger
  from nnabla.parameter import get_parameters
  from nnabla.utils import nnabla_pb2
  from nnabla.utils.get_file_handle import FileHandlerContext, get_default_file_savers, save_files
label_desc: Use image node_id 9 for calling a global function with example usage: create_proto(contents, include_params, variable_batch_size, save_solver_in_proto) and returns: proto