def get_format_modules(reverse=False, locale=None):
    """
    Returns an iterator over the format modules found in the project and Django.
    """
    modules = []
    if not locale or not check_for_language(get_language()) \
                                        or not settings.USE_L10N:
        return modules
    if not locale:
        locale = get_language()

    locale = to_locale(locale)

    if settings.FORMAT_MODULE_PATH:
        format_locations = [settings.FORMAT_MODULE_PATH + '.%s']
    else:
        format_locations = []
    format_locations.append('django.conf.locale.%s')
    for location in format_locations:
        for l in (locale, locale.split('_')[0]):
            try:
                mod = import_module('.formats', location % l)
            except __HOLE__:
                pass
            else:
                # Don't return duplicates
                if mod not in modules:
                    modules.append(mod)
    if reverse:
        modules.reverse()
    return modules
dataset/ETHPy150Open willhardy/Roll-Your-Own/rollyourown/commerce/utils/formatting.py/get_format_modules