code: def _nnp_file_saver(ctx, filename, ext, pf=".h5", ssf=None):
      logger.info("Saving {} as nnp".format(filename))
      if ssf and ssf not in [".h5", ".protobuf"]:
          logger.error(
              f"{ssf} format is not supported when save optimizer solver state."
          )
  
      nntxt = io.StringIO()
      _nntxt_file_saver(ctx, nntxt, ".nntxt")
  
      version = io.StringIO()
      version.write("{}\n".format(nnp_version()))
      version.seek(0)
  
      param = io.BytesIO()
      pf = pf if pf == ".h5" else ".protobuf"
      if ctx.parameters is None:
          nn.parameter.save_parameters(param, extension=pf)
      else:
          nn.parameter.save_parameters(
              param, ctx.parameters, extension=pf
          )
      if ssf:
          from nnabla.utils.cli.utility import save_optimizer_states
  
          filenamebase = os.path.splitext(filename)[0]
          opti_filenames = save_optimizer_states(filenamebase, ssf, ctx)
  
      with get_file_handle_save(filename, ext) as nnp:
          nnp.writestr("nnp_version.txt", version.read())
          nnp.writestr("network.nntxt", nntxt.read())
          nnp.writestr(f"parameter{pf}", param.read())
          if ssf:
              for f in opti_filenames:
                  nnp.write(f, f[len(filenamebase) + 1 :])
  
      if ssf:
          for f in opti_filenames:
              os.unlink(f)
  
imports: import contextlib
  import io
  import os
  import re
  import zipfile
  from collections import OrderedDict
  from functools import partial
  import google.protobuf.text_format
  import h5py
  import nnabla
  import numpy
  from nnabla.logger import logger
  from nnabla.utils import nnabla_pb2
  from nnabla.utils.nnp_format import nnp_version
label_desc: Use image node_id 20 for calling a global function with example usage: _nnp_file_saver(ctx, filename, ext, pf, ssf) without return types