<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def load_plugins(config, plugin_kwargs):
 """ Discover and instantiate plugins. Args: config (dict):
 loaded configuration for the Gordon service. plugin_kwargs (dict):
 keyword arguments to give to plugins during instantiation. Returns: Tuple of 3 lists: list of names of plugins, list of instantiated plugin objects, and any errors encountered while loading/instantiating plugins. A tuple of three empty lists is returned if there are no plugins found or activated in gordon config. """

    installed_plugins = _gather_installed_plugins()
    metrics_plugin = _get_metrics_plugin(config, installed_plugins)
    if metrics_plugin:
        plugin_kwargs['metrics'] = metrics_plugin

    active_plugins = _get_activated_plugins(config, installed_plugins)
    if not active_plugins:
        return [], [], [], None
    plugin_namespaces = _get_plugin_config_keys(active_plugins)
    plugin_configs = _load_plugin_configs(plugin_namespaces, config)
    plugin_names, plugins, errors = _init_plugins(
        active_plugins, installed_plugins, plugin_configs, plugin_kwargs)
    return plugin_names, plugins, errors, plugin_kwargs