docs: def filter_jobs(sacct_jobs, failed=True):
      """Filter jobs that have a FAILED etc. status."""
      categories = FAILED_CATEGORIES if failed else NORMAL_CATEGORIES
      filtered_jobs = [job for job in sacct_jobs if job['state'] in categories]
      return filtered_jobs