code: def save_diskspace(fname, reason, config):
      
      if config["algorithm"].get("save_diskspace", False):
          for ext in ["", ".bai"]:
              if os.path.exists(fname + ext):
                  with open(fname + ext, "w") as out_handle:
                      out_handle.write("File removed to save disk space: %s" % reason)
docs: Overwrite a file in place with a short message to save disk.
  
      This keeps files as a sanity check on processes working, but saves
      disk by replacing them with a short message.