code: async def _poll(self):
          
  
          while not self.finished():
              await self._delay()
              await self.update_status()
  
          if failed(self._operation.status):
              raise OperationFailed("Operation failed or cancelled")
  
          elif self._operation.should_do_final_get():
              if self._operation.method == 'POST' and self._operation.location_url:
                  final_get_url = self._operation.location_url
              else:
                  final_get_url = self._operation.initial_response.request.url
              self._response = await self.request_status(final_get_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.