docs: def _do_request(self, request, url, **kwargs):
          "Actually makes the HTTP request."
          try:
              response = request(url, stream=True, **kwargs)
          except RequestException as e:
              raise RequestError(e)
          else:
              if response.status_code >= 400:
                  raise ResponseError(response)
          # Try to return the response in the most useful fashion given it's
          # type.
          if response.headers.get('content-type') == 'application/json':
              try:
                  # Try to decode as JSON
                  return response.json()
              except (TypeError, ValueError):
                  # If that fails, return the text.
                  return response.text
          else:
              # This might be a file, so return it.
              if kwargs.get('params', {}).get('raw', True):
                  return response.raw
              else:
                  return response