def iter_capitalized_iso3166(filename):
    """
    A generator function that parses the free ISO 3166-1 alpha-2 country
    codes text file returning a tuple containing the alpha-2 code and country
    name (in that order).

    Country names are capitalized correctly (taking edge cases into account).

    Example :-

    ('AF', 'Afghanistan')
    ('AX', 'Aland Islands')
    ('AL', 'Albania')
    ('DZ', 'Algeria')
    ('AS', 'American Samoa')
    ...

    References

    ISO 3166 home page URL :-

        http://www.iso.org/iso/country_codes.htm

    ISO 3166-1-alpha-2 text file URL :-

        http://www.iso.org/iso/list-en1-semic-3.txt

    """
    line_count = 0
    for line in open(filename):
        line_count += 1

        if line_count > 2:
            cname, cc = line.strip().split(';')
            yield (cc, capitalize_country_name(cname))

    A generator function that parses the free ISO 3166-1 alpha-2 country
    codes text file returning a tuple containing the alpha-2 code and country
    name (in that order).

    Country names are capitalized correctly (taking edge cases into account).

    Example :-

    ('AF', 'Afghanistan')
    ('AX', 'Aland Islands')
    ('AL', 'Albania')
    ('DZ', 'Algeria')
    ('AS', 'American Samoa')
    ...

    References

    ISO 3166 home page URL :-

        http://www.iso.org/iso/country_codes.htm

    ISO 3166-1-alpha-2 text file URL :-

        http://www.iso.org/iso/list-en1-semic-3.txt

    
recipes/Python/576768_Capitalizing_ISO_3166_country_names/recipe-576768.py