docs: def _jobresult(self, jobid, json=True, headers=None):
          """Poll the async job result.
  
          To be run via in a Thread, the result is put within
          the result list which is a hack.
          """
          failures = 0
  
          total_time = self.job_timeout or 2**30
          remaining = timedelta(seconds=total_time)
          endtime = datetime.now() + remaining
  
          while remaining.total_seconds() > 0:
              timeout = max(min(self.timeout, remaining.total_seconds()), 1)
              try:
                  kind, params = self._prepare_request('queryAsyncJobResult',
                                                       jobid=jobid)
  
                  transform(params)
                  params['signature'] = self._sign(params)
  
                  req = requests.Request(self.method,
                                         self.endpoint,
                                         headers=headers,
                                         **{kind: params})
                  prepped = req.prepare()
                  if self.trace:
                      print(prepped.method, prepped.url, file=sys.stderr)
                      if prepped.headers:
                          print(prepped.headers, "\n", file=sys.stderr)
                      if prepped.body:
                          print(prepped.body, file=sys.stderr)
                      else:
                          print(file=sys.stderr)
  
                  with requests.Session() as session:
                      response = session.send(prepped,
                                              timeout=timeout,
                                              verify=self.verify,
                                              cert=self.cert)
  
                  j = self._response_value(response, json)
  
                  if self.trace:
                      print(response.status_code, response.reason,
                            file=sys.stderr)
                      headersTrace = "\n".join(
                              "{}: {}".format(k, v)
                              for k, v in response.headers.items())
                      print(headersTrace, "\n", file=sys.stderr)
                      print(response.text, "\n", file=sys.stderr)
  
                  failures = 0
                  if j['jobstatus'] != PENDING:
                      if j['jobresultcode'] or j['jobstatus'] != SUCCESS:
                          raise CloudStackException("Job failure",
                                                    response=response)
  
                      if 'jobresult' not in j:
                          raise CloudStackException("Unknown job result",
                                                    response=response)
  
                      return j['jobresult']
  
              except CloudStackException:
                  raise
  
              except Exception as e:
                  failures += 1
                  if failures > 10:
                      raise e
  
              time.sleep(self.poll_interval)
              remaining = endtime - datetime.now()
  
          if response:
              response.status_code = 408
  
          raise CloudStackException("Timeout waiting for async job result",
                                    jobid,
                                    response=response)