def METHOD_NAME(func):
    def wrapper(self, *args, **kwargs):
        # response type will override the response of the class.
        logger.debug(
            f"Sending HTTP request using function {func.__name__} with args: {args}, kwargs: {kwargs}"
        )
        http_response = func(self, *args, **kwargs)
        if http_response.status_code != expected_valid_code:
            try:
                response_as_json = http_response.json()
            except JSONDecodeError:
                raise CircleCIError(f"Error: ({http_response.text})")
            raise CircleCIError(f"Error: ({response_as_json})")
        if response_type == "class":
            return http_response.json(
                object_hook=lambda response: CircleCIResponse(**response)
            )
        elif response_type == "json":
            return http_response.json()
        else:  # in case the entire response object is needed
            return http_response
    return wrapper