code: def get_failed_jobs(self, fail_running=False, fail_pending=False):
          
          failed_jobs = {}
          for job_key, job_details in self.jobs.items():
              if job_details.status == JobStatus.failed:
                  failed_jobs[job_key] = job_details
              elif job_details.status == JobStatus.partial_failed:
                  failed_jobs[job_key] = job_details
              elif fail_running and job_details.status == JobStatus.running:
                  failed_jobs[job_key] = job_details
              elif fail_pending and job_details.status <= JobStatus.pending:
                  failed_jobs[job_key] = job_details
          return failed_jobs
docs: Return a dictionary with the subset of jobs that are marked as failed
  
          Parameters
          ----------
          fail_running : `bool`
              If True, consider running jobs as failed
  
          fail_pending : `bool`
              If True, consider pending jobs as failed
  
          Returns
          -------
          failed_jobs : dict
              Dictionary mapping from job key to `JobDetails` for the failed jobs.