code: def clean(self, global_epoch_idx):
          
          if self.cleaned:
              return
  
          self.cleaned = True
          self.backend.clean(global_epoch_idx)
  
          self._make_sure_dir_exists()
  
          for x in os.listdir(self.model_config.checkpoint_dir()):
              match = re.match('checkpoint_(\\d+)\\.data', x)
  
              if match:
                  idx = int(match[1])
  
                  if idx > global_epoch_idx:
                      os.remove(os.path.join(self.model_config.checkpoint_dir(), x))
  
              match = re.match('checkpoint_hidden_(\\d+)\\.data', x)
  
              if match:
                  idx = int(match[1])
  
                  if idx > global_epoch_idx:
                      os.remove(os.path.join(self.model_config.checkpoint_dir(), x))
  
              match = re.match('checkpoint_best_(\\d+)\\.data', x)
  
              if match:
                  idx = int(match[1])
  
                  if idx > global_epoch_idx:
                      os.remove(os.path.join(self.model_config.checkpoint_dir(), x))
docs: Clean old checkpoints