def lookup_ip_country(address, database):
    """Returns the country code for a given ip address."""
    info = database.get(address)
    try:
        return info['country']['iso_code']
    except Exception:
        return ''