code: def _save_parameters(args, suffix, epoch, train_config, force=False):
      global _save_parameter_info
  
      if suffix not in _save_parameter_info:
          _save_parameter_info[suffix] = {}
          _save_parameter_info[suffix]["epoch"] = 0
          _save_parameter_info[suffix]["time"] = 0
  
      current_time = time.time()
      timediff = current_time - _save_parameter_info[suffix]["time"]
      epochdiff = epoch - _save_parameter_info[suffix]["epoch"]
  
      globname = os.path.join(
          args.outdir, "results_{}_*.nnp".format(suffix)
      )
      exists = glob.glob(globname)
  
      base = os.path.join(
          args.outdir, "results_{}_{}".format(suffix, epoch)
      )
      base_candidate = callback.result_base(base, suffix, args.outdir)
      if base_candidate is None:
          if suffix is None or suffix == "best":
              base = os.path.join(args.outdir, "results")
      else:
          base = base_candidate
  
      filename = base + ".nnp"
  
      if force or (
          not os.path.exists(filename)
          and (timediff > 180.0 or epochdiff > 10)
      ):
          # Remove existing nnp before saving new file.
          for exist in exists:
              os.unlink(exist)
  
          version_filename = base + "_version.txt"
  
          with open(version_filename, "w") as file:
              file.write("{}\n".format(nnp_version()))
  
          param_filename = f'{base}_param{nnabla_config.get("MISC", "nnp_param_format")}'
          save_parameters(param_filename)
  
          need_save_opti = (
              train_config.optimizers
              and epoch % _OPTIMIZER_CHECKPOINT_INTERVAL == 0
          )
          if need_save_opti:
              opti_filenames = save_optimizer_states(
                  base, ".h5", train_config
              )
  
          with zipfile.ZipFile(filename, "w") as nnp:
              nnp.write(version_filename, "nnp_version.txt")
              nnp.write(
                  _save_parameter_info["config"],
                  os.path.basename(_save_parameter_info["config"]),
              )
              nnp.write(
                  param_filename,
                  f'parameter{nnabla_config.get("MISC", "nnp_param_format")}',
              )
              if need_save_opti:
                  for f in opti_filenames:
                      nnp.write(f, f[len(base) + 1 :])
  
          os.unlink(version_filename)
          os.unlink(param_filename)
          if need_save_opti:
              for f in opti_filenames:
                  os.unlink(f)
  
          _save_parameter_info[suffix]["epoch"] = epoch
          _save_parameter_info[suffix]["time"] = current_time
  
          callback.save_train_snapshot()
  
imports: import glob
  import os
  import time
  import zipfile
  from collections import OrderedDict
  import nnabla
  import nnabla.utils.callback
  import nnabla.utils.load
  import numpy
  from contextlib2 import ExitStack
  from nnabla import available_contexts
  from nnabla.config import nnabla_config
  from nnabla.logger import logger
  from nnabla.parameter import save_parameters
  from nnabla.utils.cli.utility import NodeTimeInfoCollector
  from nnabla.utils.cli.utility import get_cpu_gpu_average_load
  from nnabla.utils.cli.utility import let_data_to_variable
  from nnabla.utils.cli.utility import lms_scheduler
  from nnabla.utils.cli.utility import load_train_state
  from nnabla.utils.cli.utility import measure_cpu_gpu_instant_load
  from nnabla.utils.cli.utility import save_optimizer_states
  from nnabla.utils.cli.utility import str_to_num
  from nnabla.utils.communicator_util import current_communicator, single_or_rankzero
  from nnabla.utils.nnp_format import nnp_version
  from nnabla.utils.progress import configure_progress, progress
  from six.moves import range
label_desc: Use image node_id 2 for calling a global function with example usage: _save_parameters(args, suffix, epoch, train_config, force) without return types