code: def invoke(self, method, relpath=None, params=None, data=None, headers=None):
      
      path = self._join_uri(relpath)
      resp = self._client.execute(method,
                                  path,
                                  params=params,
                                  data=data,
                                  headers=headers)
      try:
        body = resp.read()
      except Exception, ex:
        raise Exception("Command '%s %s' failed: %s" %
                        (method, path, ex))
  
      self._client.logger.debug(
          "%s Got response: %s%s" %
          (method, body[:32], len(body) > 32 and "..." or ""))
  
      # Is the response application/json?
      if len(body) != 0 and \
            resp.info().getmaintype() == "application" and \
            resp.info().getsubtype() == "json":
        try:
          json_dict = json.loads(body)
          return json_dict
        except Exception, ex:
          self._client.logger.exception('JSON decode error: %s' % (body,))
          raise ex
      else:
        return body
docs: Invoke an API method.
      @return: Raw body or JSON dictionary (if response content type is JSON).