def _validate_response(self, response, message, exclude_code=None):  # pylint: disable=no-self-use
        """
        validate an api server response

        :param dict response: server response to check
        :param str message: error message to raise
        :param int exclude_code: error codes to exclude from errorhandling
        :return:
        ":raises Exception: on error
        """
        if 'code' in response and response['code'] >= 2000:
            if exclude_code is not None and response['code'] == exclude_code:
                return

            raise Exception("{0}: {1} ({2})".format(
                message, response['msg'], response['code']))