code: def _request(self, method, path, op, expected_status=httplib.OK, **kwargs):
          
          hosts, path = self._parse_path(path)
          _transform_user_name_key(kwargs)
          kwargs.setdefault('user.name', self.user_name)
  
          formatted_args = ' '.join('{}={}'.format(*t) for t in kwargs.items())
          _logger.info("%s %s %s %s", op, path, formatted_args, ','.join(hosts))
          kwargs['op'] = op
          for i in range(self.max_tries):
              log_level = logging.DEBUG if i < self.max_tries - 1 else logging.WARNING
              for host in hosts:
                  try:
                      response = self._requests_session.request(
                          method,
                          'http://{}{}{}'.format(host, WEBHDFS_PATH, url_quote(path.encode('utf-8'))),
                          params=kwargs, timeout=self.timeout, allow_redirects=False,
                          **self._requests_kwargs
                      )
                  except (requests.exceptions.ConnectionError, requests.exceptions.Timeout):
                      _logger.log(log_level, "Failed to reach to %s (attempt %d/%d)",
                                  host, i + 1, self.max_tries, exc_info=True)
                      continue
                  try:
                      _check_response(response, expected_status)
                  except (HdfsRetriableException, HdfsStandbyException):
                      _logger.log(log_level, "%s is in startup or standby mode (attempt %d/%d)",
                                  host, i + 1, self.max_tries, exc_info=True)
                      continue
                  # Note: standby NN can still return basic validation errors, so non-StandbyException
                  # does not necessarily mean we have the active NN.
                  self._record_last_active(host)
                  return response
              if i != self.max_tries - 1:
                  time.sleep(self.retry_delay)
          raise HdfsNoServerException("Could not use any of the given hosts")
docs: Make a WebHDFS request against the NameNodes
  
          This function handles NameNode failover and error checking.
          All kwargs are passed as query params to the WebHDFS server.