docs: def wait_on_done(self, interval=2, timeout=3600*24*7, **kwargs):
          '''
          :param interval: Number of seconds between queries to the job's state
          :type interval: integer
          :param timeout: Maximum amount of time to wait, in seconds, until the job is done running
          :type timeout: integer
          :raises: :exc:`~dxpy.exceptions.DXError` if the timeout is reached before the job has finished running, or :exc:`dxpy.exceptions.DXJobFailureError` if the job fails
  
          Waits until the job has finished running.
          '''
  
          elapsed = 0
          while True:
              state = self._get_state(**kwargs)
              if state == "done":
                  break
              if state == "failed":
                  desc = self.describe(**kwargs)
                  err_msg = "Job has failed because of {failureReason}: {failureMessage}".format(**desc)
                  if desc.get("failureFrom") != None and desc["failureFrom"]["id"] != desc["id"]:
                      err_msg += " (failure from {id})".format(id=desc['failureFrom']['id'])
                  raise DXJobFailureError(err_msg)
              if state == "terminated":
                  raise DXJobFailureError("Job was terminated.")
  
              if elapsed >= timeout or elapsed < 0:
                  raise DXJobFailureError("Reached timeout while waiting for the job to finish")
  
              time.sleep(interval)
              elapsed += interval