def country_code_by_addr(self, addr):
VALID_EDITIONS = (const.COUNTRY_EDITION, const.COUNTRY_EDITION_V6)<EOL>if self._databaseType in VALID_EDITIONS:<EOL><INDENT>country_id = self.id_by_addr(addr)<EOL>return const.COUNTRY_CODES[country_id]<EOL><DEDENT>elif self._databaseType in const.REGION_CITY_EDITIONS:<EOL><INDENT>return self.region_by_addr(addr).get('<STR_LIT>')<EOL><DEDENT>raise GeoIPError('<STR_LIT>')<EOL>
Returns 2-letter country code (e.g. US) from IP address.

:arg addr: IP address (e.g. 203.0.113.30)