code: def _check_for_cancel(self, job_id, current_stage=""):
          
  
          future = self.future_job_mapping[job_id]
          is_cancelled = future._state in [CANCELLED, CANCELLED_AND_NOTIFIED]
  
          if is_cancelled:
              raise UserCancelledError(last_stage=current_stage)
docs: Check if a job has been requested to be cancelled. When called, the calling function can
          optionally give the stage it is currently in, so the user has information on where the job
          was before it was cancelled.
  
          :param job_id: The job_id to check
          :param current_stage: Where the job currently is
  
          :return: raises a CancelledError if we find out that we were cancelled.