code: def save_checkpoint(state, is_best, filename):
      r"""Save the model to a temporary file first,
      then copy it to filename, in case the signal interrupts
      the torch.save() process.
      """
  
      if filename == "":
          return
  
      tempfile = filename + ".temp"
  
      # Remove tempfile in case interuption during the copying from tempfile to filename
      if os.path.isfile(tempfile):
          os.remove(tempfile)
  
      torch.save(state, tempfile)
      if os.path.isfile(tempfile):
          os.rename(tempfile, filename)
      if is_best:
          shutil.copyfile(filename, "model_best.pth.tar")
      logging.info("Checkpoint: saved")
  
file_path: audio/examples/pipeline_wavernn/utils.py
imports: import logging
  import os
  import shutil
  from collections import defaultdict, deque
  import torch
label_desc: Use image node_id 1 for calling a global function with example usage: save_checkpoint(state, is_best, filename) without return types