'Enable a plugin, including any dependencies.
:param string name: The short name of the plugin.
:param dict config: Optional settings dictionary for
configuring plugin behaviour.'

def enable(self, name, config=None, enabled=None):

    top_level = False
    if (enabled is None):
        enabled = set()
    with self._plugin_lock:
        if (name not in self._enabled):
            enabled.add(name)
            self._enabled.add(name)
            if (not self.registered(name)):
                load_plugin(name)
            plugin_class = PLUGIN_REGISTRY.get(name, None)
            if (not plugin_class):
                raise PluginNotFound(name)
            if (config is None):
                config = self.config.get(name, None)
            plugin = plugin_class(self.xmpp, config)
            self._plugins[name] = plugin
            for dep in plugin.dependencies:
                self.enable(dep, enabled=enabled)
            plugin._init()
    if top_level:
        for name in enabled:
            if hasattr(self.plugins[name], 'old_style'):
                pass
            self.plugins[name].post_init()
