def autodiscover():
    """Auto-discover INSTALLED_APPS mails.py modules."""

    for app in settings.INSTALLED_APPS:
        module = '%s.mails' % app  # Attempt to import the app's 'mails' module
        try:
            import_module(module)
        except:
            # Decide whether to bubble up this error. If the app just
            # doesn't have a mails module, we can ignore the error
            # attempting to import it, otherwise we want it to bubble up.
            app_module = import_module(app)
            if module_has_submodule(app_module, 'mails'):
                raise


# If we're using Django >= 1.7, use the new app-loading mecanism which is way
# better.
dataset/ETHPy150Open novafloss/django-mail-factory/mail_factory/models.py/autodiscover/original