@classmethod
def get_tax_rate(cls, tax_id, country_code):
    issuer_country_code = cls.get_issuer_country_code()
    if (not cls.is_in_EU(issuer_country_code)):
        raise ImproperlyConfigured('EUTaxationPolicy requires that issuer country is in EU')
    if ((not tax_id) and (not country_code)):
        return cls.get_default_tax()
    elif ((not tax_id) and country_code):
        if cls.is_in_EU(country_code):
            return cls.EU_COUNTRIES_VAT[country_code]
        else:
            return None
    else:
        if (country_code.upper() == issuer_country_code.upper()):
            return cls.get_default_tax()
        if cls.is_in_EU(country_code):
            try:
                vies_result = vatnumber.check_vies(tax_id)
                logger.info(('TAX_ID=%s RESULT=%s' % (tax_id, vies_result)))
                if (tax_id and vies_result):
                    return None
                else:
                    return cls.EU_COUNTRIES_VAT[country_code]
            except (WebFault, TransportError, stdnum.exceptions.InvalidComponent):
                logger.exception(('TAX_ID=%s' % tax_id))
                return cls.EU_COUNTRIES_VAT[country_code]
        else:
            return None
@classmethod
def get_tax_rate(cls, tax_id, country_code):
    issuer_country_code = cls.get_issuer_country_code()
    if (not cls.is_in_EU(issuer_country_code)):
        raise ImproperlyConfigured('EUTaxationPolicy requires that issuer country is in EU')
    if ((not tax_id) and (not country_code)):
        return cls.get_default_tax()
    elif ((not tax_id) and country_code):
        if cls.is_in_EU(country_code):
            return cls.EU_COUNTRIES_VAT[country_code]
        else:
            return None
    else:
        if (country_code.upper() == issuer_country_code.upper()):
            return cls.get_default_tax()
        if cls.is_in_EU(country_code):
            try:
                vies_result = vatnumber.check_vies(tax_id)
                logger.info(('TAX_ID=%s RESULT=%s' % (tax_id, vies_result)))
                if (tax_id and vies_result):
                    return None
                else:
                    return cls.EU_COUNTRIES_VAT[country_code]
            except (WebFault, TransportError, stdnum.exceptions.InvalidComponent):
                logger.exception(('TAX_ID=%s' % tax_id))
                return cls.EU_COUNTRIES_VAT[country_code]
        else:
            return None