'Dynamically loads all the modules in the modules folder and sorts
them by the PRIORITY key. If no PRIORITY is defined for a given
module, a priority of 0 is assumed.'

@classmethod
def get_modules(cls):

    logger = logging.getLogger(__name__)
    locations = [jasperpath.PLUGIN_PATH]
    logger.debug('Looking    for    modules    in:    %s', ',    '.join([("'%s'" % location) for location in locations]))
    modules = []
    for (finder, name, ispkg) in pkgutil.walk_packages(locations):
        try:
            loader = finder.find_module(name)
            mod = loader.load_module(name)
        except:
            logger.warning("Skipped    module    '%s'    due    to    an    error.", name, exc_info=True)
        else:
            if hasattr(mod, 'WORDS'):
                logger.debug("Found    module    '%s'    with    words:    %r", name, mod.WORDS)
                modules.append(mod)
            else:
                logger.warning(("Skipped    module    '%s'    because    it    misses    " + 'the    WORDS    constant.'), name)
    modules.sort(key=(lambda mod: (mod.PRIORITY if hasattr(mod, 'PRIORITY') else 0)), reverse=True)
    return modules
