This method parses all the HTTP responses sent by the REST API and
        raises exceptions if required. Basically tries to find responses with
        this format:

            {
                'error': ['The domain foo.com already exists.']
            }

        Or this other:
            {
                "scans": {
                    "__all__": [
                        "Not a verified domain. You need to verify..."
                    ]
                }
            }

        And raise TagCubeAPIException with the correct message.

        :param status_code: The HTTP response code
        :param json_data: The HTTP response body decoded as JSON

def handle_api_errors(self, status_code, json_data):
        """
        This method parses all the HTTP responses sent by the REST API and
        raises exceptions if required. Basically tries to find responses with
        this format:

            {
                'error': ['The domain foo.com already exists.']
            }

        Or this other:
            {
                "scans": {
                    "__all__": [
                        "Not a verified domain. You need to verify..."
                    ]
                }
            }

        And raise TagCubeAPIException with the correct message.

        :param status_code: The HTTP response code
        :param json_data: The HTTP response body decoded as JSON
        """
        error_list = []

        if 'error' in json_data and len(json_data) == 1 \
        and isinstance(json_data, dict) and isinstance(json_data['error'], list):
            error_list = json_data['error']

        elif status_code == 400:
            for main_error_key in json_data:
                for sub_error_key in json_data[main_error_key]:
                    error_list.extend(json_data[main_error_key][sub_error_key])

        # Only raise an exception if we had any errors
        if error_list:
            error_string = u' '.join(error_list)
            raise TagCubeAPIException(error_string)