code: def cleanup_params_files(output_folder: str, max_to_keep: int, checkpoint: int, best_checkpoint: int, keep_first: bool):
      
      if max_to_keep <= 0:
          return
      existing_files = glob.glob(os.path.join(output_folder, C.PARAMS_PREFIX + "*"))
      params_name_with_dir = os.path.join(output_folder, C.PARAMS_NAME)
      for n in range(1 if keep_first else 0, max(1, checkpoint - max_to_keep + 1)):
          if n != best_checkpoint:
              param_fname_n = params_name_with_dir % n
              if param_fname_n in existing_files:
                  os.remove(param_fname_n)
docs: Deletes oldest parameter files from a model folder.
  
      :param output_folder: Folder where param files are located.
      :param max_to_keep: Maximum number of files to keep, negative to keep all.
      :param checkpoint: Current checkpoint (i.e. index of last params file created).
      :param best_checkpoint: Best checkpoint. The parameter file corresponding to this checkpoint will not be deleted.
      :param keep_first: Don't delete the first checkpoint.