'Submit an HTTP request.
@param http_method: GET, POST, PUT, DELETE
@param path: The path of the resource. Unsafe characters will be quoted.
@param params: Key-value parameter data.
@param data: The data to attach to the body of the request.
@param headers: The headers to set for this request.
@param allow_redirects: requests should automatically resolve redirects.
@param urlencode: percent encode paths.
@param files: for posting Multipart-Encoded files
@param clear_cookies: flag to force clear any cookies set in the current session
@return: The result of urllib2.urlopen()'

def execute(self, http_method, path, params=None, data=None, headers=None, allow_redirects=False, urlencode=True, files=None, clear_cookies=False):

    if urlencode:
        path = urllib.quote(smart_str(path))
    url = self._make_url(path, params)
    if (http_method in ('GET', 'DELETE')):
        if (data is not None):
            self.logger.warn(("GET    and    DELETE    methods    do    not    pass    any    data.    Path    '%s'" % path))
            data = None
    request_kwargs = {'allow_redirects': allow_redirects}
    if headers:
        request_kwargs['headers'] = headers
    if data:
        request_kwargs['data'] = data
    if files:
        request_kwargs['files'] = files
    if (self._cookies and (not clear_cookies)):
        request_kwargs['cookies'] = self._cookies
    if clear_cookies:
        self._session.cookies.clear()
    try:
        resp = getattr(self._session, http_method.lower())(url, **request_kwargs)
        if (resp.status_code >= 300):
            resp.raise_for_status()
            raise exceptions.HTTPError(response=resp)
        self._cookies = resp.cookies
        return resp
    except (exceptions.ConnectionError, exceptions.HTTPError, exceptions.RequestException, exceptions.URLRequired, exceptions.TooManyRedirects) as ex:
        raise self._exc_class(ex)
