Core "worker" for making requests and parsing JSON responses.

        If `is_json` is ``True``, `data` should be a dictionary which
        will be JSON-encoded.

def request(self, request_path, data=None, do_authentication=True, is_json=True):
        """
        Core "worker" for making requests and parsing JSON responses.

        If `is_json` is ``True``, `data` should be a dictionary which
        will be JSON-encoded.
        """
        uri = self.api_uri % request_path
        request = urllib2.Request(uri)

        # Build up the request
        if is_json:
            request.add_header("Content-Type", "application/json")
            if data is not None:
                request.add_data(json.dumps(data))
        elif data is not None:
            request.add_data(data)

        if do_authentication:
            if self.client_id is None or self.client_secret is None:
                raise Exception(u"You need to supply a client_id and client_secret to perform an authenticated request")
            basic_auth = base64.b64encode("%s:%s" % (self.client_id, self.client_secret))
            request.add_header("Authorization", "Basic %s" % basic_auth)

        try:
            response = self._make_request(request)
        except Exception as inst:
            raise # automatically re-raises the exception

        if 'status' in response:
            # Grab the status info if it exists
            self._last_status_code = response['status']['code']
            if 'message' in response['status']:
                self._last_status_message = response['status']['message']

            if 'data' in response:
                return response['data']

        return response