code: def _save(path, filename, target):
      # Simple save_npz may cause partial write - instead copied and
      # modified a bit from chainer.extensions.snapshot.
      _maybe_makedirs(path)
      prefix = "tmp-" + filename
      fd, tmppath = tempfile.mkstemp(prefix=prefix, dir=path)
      try:
          chainer.serializers.save_npz(tmppath, target)
      except Exception:
          os.close(fd)
          os.remove(tmppath)
          raise
      os.close(fd)
      shutil.move(tmppath, os.path.join(path, filename))
  
imports: import errno
  import os
  import shutil
  import tempfile
  import time
  import warnings
  import chainer
  from chainer.training import extension
label_desc: Use image node_id 3 for calling a global function with example usage: _save(path, filename, target) without return types