def build_iso639a(filename):
    import urllib2
    url = URLS["languagecodes8bit"]
    req = urllib2.Request(url, None)
    req.add_header("User-Agent",'Mozilla/5.0 (Pycopia)')
    req.add_header("Accept", "text/plain")
    req.add_header("Accept-Charset", "iso-8859-1,utf-8")
    req.add_header("Accept-Language", "*")
    ccf = urllib2.urlopen(req)

    outf = open(filename, "w")
    outf.write("""#!/usr/bin/python2.4
# -*- coding: utf-8 -*-
# generated by build_iso639a()

""")
    outf.write("LANGUAGECODES = {\n")

    for line in ccf.readlines():
        parts = line.split("|")
        if len(parts) != 5:
            continue
        [alpha3_bib, alpha3_term, alpha2, name_en, name_fr] = map(str.strip, parts)
        if alpha2:
            name_en = unicode(name_en, 'utf-8')
            outf.write((alpha2.lower(), name_en.capitalize()) % "  %r: %r,\n")
    outf.write("}\n\n")
    outf.close()
    ccf.close()
dataset/ETHPy150Open kdart/pycopia/core/pycopia/ISO/__init__.py/build_iso639a/swapped operands of `%`