code: def _poll(self, update_cmd):
          
          initial_url = self._response.request.url
  
          while not finished(self.status()):
              self._delay()
              headers = self._polling_cookie()
  
              if self._operation.async_url:
                  self._response = update_cmd(
                      self._operation.async_url, headers)
                  self._operation.set_async_url_if_present(self._response)
                  self._operation.get_status_from_async(
                      self._response)
              elif self._operation.location_url:
                  self._response = update_cmd(
                      self._operation.location_url, headers)
                  self._operation.set_async_url_if_present(self._response)
                  self._operation.get_status_from_location(
                      self._response)
              elif self._operation.method == "PUT":
                  self._response = update_cmd(initial_url, headers)
                  self._operation.set_async_url_if_present(self._response)
                  self._operation.get_status_from_resource(
                      self._response)
              else:
                  raise BadResponse(
                      'Location header is missing from long running operation.')
  
          if failed(self._operation.status):
              raise OperationFailed("Operation failed or cancelled")
          elif self._operation.should_do_final_get():
              self._response = update_cmd(initial_url)
              self._operation.get_status_from_resource(
                  self._response)
docs: Poll status of operation so long as operation is incomplete and
          we have an endpoint to query.
  
          :param callable update_cmd: The function to call to retrieve the
           latest status of the long running operation.
          :raises: OperationFailed if operation status 'Failed' or 'Cancelled'.
          :raises: BadStatus if response status invalid.
          :raises: BadResponse if response invalid.