Imports configuration from all the modules and merges it.

def import_dashboard_config(modules):
    """Imports configuration from all the modules and merges it."""
    config = collections.defaultdict(dict)
    for module in modules:
        for submodule in import_submodules(module).values():
            if hasattr(submodule, 'DASHBOARD'):
                dashboard = submodule.DASHBOARD
                config[dashboard].update(submodule.__dict__)
            elif (hasattr(submodule, 'PANEL') or
                  hasattr(submodule, 'PANEL_GROUP') or
                  hasattr(submodule, 'FEATURE')):
                # If enabled and local.enabled contains a same filename,
                # the file loaded later (i.e., local.enabled) will be used.
                name = submodule.__name__.rsplit('.', 1)[1]
                config[name] = submodule.__dict__
            else:
                logging.warning("Skipping %s because it doesn't have DASHBOARD"
                                ", PANEL, PANEL_GROUP, or FEATURE defined.",
                                submodule.__name__)
    return sorted(config.items(),
                  key=lambda c: c[1]['__name__'].rsplit('.', 1)[1])