def normalizeCountry(country_str, target='iso3c'):
    """Return a normalized name/code for country in `country_str`.
    The input can be a code or name, the `target` determines output value.
    3 character ISO code is the default (iso3c), or 'iso2c'; otherwise then formal name is returned.

    Raises ``ValueError`` if the country is unrecognized.
    """
    from iso3166 import countries
    iso2 = 'iso2c'
    iso3 = 'iso3c'
    if country_str is None:
        return ''
    elif country_str.lower() == 'united states':
        country_str += ' of america'
    try:
        cc = countries.get(country_str)
    except KeyError:
        raise ValueError(f'Country not found: {country_str}')
    else:
        if target == iso3:
            return cc.alpha3
        elif target == iso2:
            return cc.alpha2
        else:
            return cc.name
