def import_app(app_label, verbosity):
    # We get the app_path, necessary to use imp module find function
    try:
        app_path = __import__(app_label, {}, {}, [app_label.split('.')[-1]]).__path__
    except AttributeError:
        return
    except __HOLE__:
        print "Unknown application: %s" % app_label
        print "Stopping synchronization"
        sys.exit(1)
   
    # imp.find_module looks for rules.py within the app
    # It does not import the module, but raises and ImportError
    # if rules.py does not exist, so we continue to next app
    try:
        imp.find_module('rules', app_path)
    except ImportError:
        return

    if verbosity >= 1:
        sys.stderr.write('Syncing rules from %s\n' % app_label)
    
    # Now we import the module, this should bubble up errors
    # if there are any in rules.py Warning the user
    generator = import_module('.rules', app_label)
dataset/ETHPy150Open maraujop/django-rules/django_rules/management/commands/sync_rules.py/import_app