def iter_format_modules(lang):
if check_for_language(lang):<EOL><INDENT>format_locations = []<EOL>for path in CUSTOM_FORMAT_MODULE_PATHS:<EOL><INDENT>format_locations.append(path + '<STR_LIT>')<EOL><DEDENT>format_locations.append('<STR_LIT>')<EOL>locale = to_locale(lang)<EOL>locales = [locale]<EOL>if '<STR_LIT:_>' in locale:<EOL><INDENT>locales.append(locale.split('<STR_LIT:_>')[<NUM_LIT:0>])<EOL><DEDENT>for location in format_locations:<EOL><INDENT>for loc in locales:<EOL><INDENT>try:<EOL><INDENT>yield import_module('<STR_LIT>', location % loc)<EOL><DEDENT>except ImportError:<EOL><INDENT>pass<EOL><DEDENT><DEDENT><DEDENT><DEDENT>
Does the heavy lifting of finding format modules.