code: def cleanup(self):
      to_delete = self.checkpoints[: -self.keep_last_n]
      self.checkpoints = self.checkpoints[-self.keep_last_n :]
      for f in to_delete:
          full_path = os.path.join(self.checkpoint_dir, f)
          os.remove(full_path)
  
imports: import math
  import os
  import numpy
  import torch
  import shutil
  import signal
  import torch.distributed
label_desc: Use image node_id 2 for calling the Checkpointer obj's underlying member method code with example usage: obj.cleanup() without return types