def handle_http_error(self, response, custom_messages=None,
                          raise_for_status=False):
        """Converts service errors to Python exceptions

        Parameters
        ----------
        response : requests.Response
            A service response.
        custom_messages : dict, optional
            A mapping of custom exception messages to HTTP status codes.
        raise_for_status : bool, optional
            If True, the requests library provides Python exceptions.

        Returns
        -------
        None
        """
        if not custom_messages:
            custom_messages = {}
        if response.status_code in custom_messages.keys():
            raise errors.HTTPError(custom_messages[response.status_code])
        if raise_for_status:
            response.raise_for_status()
Converts service errors to Python exceptions

        Parameters
        ----------
        response : requests.Response
            A service response.
        custom_messages : dict, optional
            A mapping of custom exception messages to HTTP status codes.
        raise_for_status : bool, optional
            If True, the requests library provides Python exceptions.

        Returns
        -------
        None