Enable installed plugin package(s).

    Each plugin package must have a directory with the same name as the package
    in the following directory:

        <conda prefix>/share/microdrop/plugins/available/

    Parameters
    ----------
    plugin_name : str or list
        Plugin package(s) to enable.

    Returns
    -------
    dict
        Dictionary containing a flag for each plugin name:

         - ``False`` iff the plugin was already enabled.
         - ``True`` iff it was just enabled now.

    Raises
    ------
    IOError
        If plugin is not installed to ``<conda prefix>/share/microdrop/plugins/available/``.

def enable_plugin(plugin_name):
    '''
    Enable installed plugin package(s).

    Each plugin package must have a directory with the same name as the package
    in the following directory:

        <conda prefix>/share/microdrop/plugins/available/

    Parameters
    ----------
    plugin_name : str or list
        Plugin package(s) to enable.

    Returns
    -------
    dict
        Dictionary containing a flag for each plugin name:

         - ``False`` iff the plugin was already enabled.
         - ``True`` iff it was just enabled now.

    Raises
    ------
    IOError
        If plugin is not installed to ``<conda prefix>/share/microdrop/plugins/available/``.
    '''
    if isinstance(plugin_name, types.StringTypes):
        plugin_name = [plugin_name]
        singleton = True
    else:
        singleton = False

    # Conda-managed plugins
    shared_available_path = MICRODROP_CONDA_SHARE.joinpath('plugins',
                                                           'available')
    # User-managed plugins
    etc_available_path = MICRODROP_CONDA_ETC.joinpath('plugins', 'available')

    available_paths = (etc_available_path, shared_available_path)
    plugin_paths = []
    for name_i in plugin_name:
        for available_path_j in available_paths:
            plugin_path_ij = available_path_j.joinpath(name_i)
            if not _islinklike(plugin_path_ij) and plugin_path_ij.isdir():
                logger.debug('Found plugin directory: `%s`', plugin_path_ij)
                break
        else:
            raise IOError('Plugin `{}` not found in `{}` or `{}`'
                          .format(name_i, *available_paths))
        plugin_paths.append(plugin_path_ij)

    # All specified plugins are available.

    # Link all specified plugins in
    # `<conda prefix>/etc/microdrop/plugins/enabled/` (if not already linked).
    enabled_path = MICRODROP_CONDA_PLUGINS.joinpath('enabled')
    enabled_path.makedirs_p()

    # Set flag for each plugin: `False` iff the plugin was already enabled,
    # `True` iff it was just enabled now.
    enabled_now = {}
    for plugin_path_i in plugin_paths:
        plugin_link_path_i = enabled_path.joinpath(plugin_path_i.name)
        if not plugin_link_path_i.exists():
            if platform.system() == 'Windows':
                plugin_path_i.junction(plugin_link_path_i)
            else:
                plugin_path_i.symlink(plugin_link_path_i)
            logger.debug('Enabled plugin directory: `%s` -> `%s`',
                         plugin_path_i, plugin_link_path_i)
            enabled_now[plugin_path_i.name] = True
        else:
            logger.debug('Plugin already enabled: `%s` -> `%s`', plugin_path_i,
                         plugin_link_path_i)
            enabled_now[plugin_path_i.name] = False
    return enabled_now if not singleton else enabled_now.values()[0]