'Invoke an API method.
@return: Raw body or JSON dictionary (if response content type is JSON).'

def invoke(self, method, relpath=None, params=None, data=None, headers=None, files=None, allow_redirects=False, clear_cookies=False):

    path = self._join_uri(relpath)
    resp = self._client.execute(method, path, params=params, data=data, headers=headers, files=files, allow_redirects=allow_redirects, urlencode=self._urlencode, clear_cookies=clear_cookies)
    if self._client.logger.isEnabledFor(logging.DEBUG):
        self._client.logger.debug(('%s    Got    response:    %s%s' % (method, smart_unicode(resp.content[:1000], errors='replace'), (((len(resp.content) > 1000) and '...') or ''))))
    return self._format_response(resp)
