docs: def clear_old_backups(self, block_id):
          """
          If we limit the number of backups we make, then clean out old ones
          older than block_id - backup_max_age (given in the constructor)
          This method does nothing otherwise.
  
          Return None on success
          Raise exception on error
          """
          assert self.setup, "Not set up yet.  Call .db_setup() first!"
  
          if self.backup_max_age is None:
              # never delete backups
              return 
  
          # find old backups 
          backup_dir = config.get_backups_directory(self.impl, self.working_dir)
          if not os.path.exists(backup_dir):
              return 
  
          backups = os.listdir( backup_dir )
          for backup_name in backups:
              if backup_name in [".", ".."]:
                  continue 
  
              backup_path = os.path.join(backup_dir, backup_name)
              backup_block = None 
  
              try:
                  backup_block = int(backup_path.split(".")[-1])
              except:
                  # not a backup file
                  log.info("Skipping non-backup '%s'" % backup_path)
  
              if not backup_path.endswith( ".bak.%s" % backup_block ):
                  # not a backup file 
                  log.info("Skipping non-backup '%s'" % backup_path)
                  continue
          
              if backup_block + self.backup_max_age < block_id:
                  # dead 
                  log.info("Removing old backup '%s'" % backup_path)
                  try:
                      os.unlink(backup_path)
                  except:
                      pass