"""Shared validation logic.""" from abacus_common_data.country import Country from abacus_contract.constants import error def validate_country_code(country_code): """Validate a country code parameter.""" try: Country(country_code) except KeyError: raise Exception( error.ERROR_UNKNOWN_COUNTRY.format(code=country_code) )