code: def classify_jobs(
      all_job_names: List[str],
      sha_grid: Any,
      filtered_jobs_names: Set[str],
  ) -> Tuple[List[JobStatus], List[Any]]:
      """
      Creates Job Statuses which has the logic for if need to alert or if there's flaky jobs.
      Classifies jobs into jobs to alert on and flaky jobs.
      :param all_job_names: list of all job names as returned by the HUD
      :param sha_grid: list of all job data as returned by the HUD (parallel index to all_job_names)
      :param filtered_jobs_names: set of job names to actually consider
      :return:
      """
      job_data = map_job_data(all_job_names, sha_grid)
      job_statuses: List[JobStatus] = []
      for job in job_data:
          job_statuses.append(JobStatus(job, job_data[job]))
  
      jobs_to_alert_on = []
      flaky_jobs = []
  
      for job_status in job_statuses:
          if job_status.job_name not in filtered_jobs_names:
              continue
          if job_status.should_alert():
              jobs_to_alert_on.append(job_status)
          flaky_jobs.extend(job_status.flaky_jobs)
  
      return jobs_to_alert_on, flaky_jobs
  
imports: import argparse
  import json
  import os
  import re
  from collections import defaultdict
  from difflib import SequenceMatcher
  from typing import Any, Dict, List, Set, Tuple
  import requests
  from setuptools import distutils
label_desc: Use image node_id 6 for calling a global function with example usage: classify_jobs(all_job_names, sha_grid, filtered_jobs_names) and returns: jobs_to_alert_on,  flaky_jobs