code: def check_job_status(self, key=JobDetails.topkey,
                           fail_running=False,
                           fail_pending=False,
                           force_check=False):
          
          if key in self.jobs:
              status = self.jobs[key].status
              if status in [JobStatus.unknown, JobStatus.ready,
                            JobStatus.pending, JobStatus.running] or force_check:
                  status = self._interface.check_job(self.jobs[key])
              if status == JobStatus.running and fail_running:
                  status = JobStatus.failed
              if status == JobStatus.pending and fail_pending:
                  status = JobStatus.failed
              self.jobs[key].status = status
              if self._job_archive:
                  self._job_archive.register_job(self.jobs[key])
          else:
              status = JobStatus.no_job
  
          return status
docs: Check the status of a particular job
  
          By default this checks the status of the top-level job, but
          can by made to drill into the sub-jobs.
  
          Parameters
          ----------
          key : str
              Key associated to the job in question
  
          fail_running : `bool`
              If True, consider running jobs as failed
  
          fail_pending : `bool`
              If True, consider pending jobs as failed
  
          force_check : `bool`
              Drill into status of individual jobs` instead of using top level job only
  
          Returns
          -------
          status : `JobStatus`
              Job status flag