'Add, remove and set default panels on the dashboard.'

def _process_panel_configuration(self, config):

    try:
        dashboard = config.get('PANEL_DASHBOARD')
        if (not dashboard):
            LOG.warning("Skipping    %s    because    it    doesn't    have    PANEL_DASHBOARD    defined.", config.__name__)
            return
        panel_slug = config.get('PANEL')
        dashboard_cls = self.get_dashboard(dashboard)
        panel_group = config.get('PANEL_GROUP')
        default_panel = config.get('DEFAULT_PANEL')
        if default_panel:
            dashboard_cls.default_panel = default_panel
        if config.get('REMOVE_PANEL', False):
            for panel in dashboard_cls.get_panels():
                if (panel_slug == panel.slug):
                    dashboard_cls.unregister(panel.__class__)
        elif config.get('ADD_PANEL', None):
            panel_path = config['ADD_PANEL']
            (mod_path, panel_cls) = panel_path.rsplit('.', 1)
            try:
                mod = import_module(mod_path)
            except ImportError:
                LOG.warning('Could    not    load    panel:    %s', mod_path)
                return
            panel = getattr(mod, panel_cls)
            if (hasattr(panel, 'can_register') and callable(getattr(panel, 'can_register'))):
                if (not panel.can_register()):
                    LOG.debug('Load    condition    failed    for    panel:    %(panel)s', {'panel': panel_slug})
                    return
            dashboard_cls.register(panel)
            if panel_group:
                dashboard_cls.get_panel_group(panel_group).panels.append(panel.slug)
            else:
                panels = list(dashboard_cls.panels)
                panels.append(panel)
                dashboard_cls.panels = tuple(panels)
    except Exception as e:
        LOG.warning('Could    not    process    panel    %(panel)s:    %(exc)s', {'panel': panel_slug, 'exc': e})
