code: def save_checkpoint(state, is_best, checkpoint):
      """Saves model and training parameters at checkpoint + 'last.pth.tar'. If is_best==True, also saves
      checkpoint + 'best.pth.tar'
  
      Args:
          state: (dict) contains the entire model, may contain other keys such as epoch, optimizer
          is_best: (bool) True if it is the best model seen till now
          checkpoint: (string) folder where parameters are to be saved
      """
      filepath = os.path.join(checkpoint, "last.pth.tar")
      if not os.path.exists(checkpoint):
          print(
              "Checkpoint Directory does not exist! Making directory {}".format(
                  checkpoint
              )
          )
          os.makedirs(checkpoint)
      torch.save(state, filepath)
      if is_best:
          shutil.copyfile(
              filepath, os.path.join(checkpoint, "best.pth.tar")
          )
  
file_path: DeepKE/src/deepke/triple_extraction/PRGC/util.py
imports: import logging
  import os
  import shutil
  import json
  from pathlib import Path
  import torch
label_desc: Use image node_id 2 for calling a global function with example usage: save_checkpoint(state, is_best, checkpoint) without return types