code: def save_model(self, is_best=False, recording=None):
      self.model.to("cpu")
      state = {"net": self.model.state_dict()}
      for key, value in recording.items():
          state[key] = value
      latest_pth_name = f"{self.save_name}_latest.pth"
      best_pth_name = f"{self.save_name}_best.pth"
      ckpt_path = os.path.join(self.save_dir, latest_pth_name)
      torch.save(state, ckpt_path)
      if is_best:
          print("saving best...")
          shutil.copy(
              ckpt_path, os.path.join(self.save_dir, best_pth_name)
          )
      self.model.to(self.device)
  
imports: import os
  import hydra
  import torch
  import shutil
  import warnings
  from torch.optim import Adam
  from omegaconf import OmegaConf
  from benchmarks.xgraph.utils import check_dir
  from benchmarks.xgraph.gnnNets import get_gnnNets
  from benchmarks.xgraph.dataset import get_dataset, get_dataloader
  import torch.nn.functional
  from torch.optim.lr_scheduler import MultiStepLR
  from utils import fix_random_seed
label_desc: Use image node_id 8 for calling the TrainModel obj's underlying member method code with example usage: obj.save_model(is_best, recording) without return types