def process_plugins_for(config, options):
    """
    Given a `Coherence` configuration and an object of parsed options, returns
    the configuration based on the supplied options for the plugins.
    """
    plugins = config.get('plugin')
    if isinstance(plugins, dict):
        config['plugin'] = [plugins]
    if not plugins:
        plugins = config.get('plugins', None)
    if not plugins:
        config['plugin'] = []
        plugins = config['plugin']
    while len(options.plugins) > 0:
        p = options.plugins.pop()
        plugin = {}
        plugin_conf = p.split(',')
        for pair in plugin_conf:
            pair = pair.split(':', 1)
            if len(pair) == 2:
                pair[0] = pair[0].strip()
                if pair[0] in plugin:
                    if not isinstance(plugin[pair[0]], list):
                        new_list = [plugin[pair[0]]]
                        plugin[pair[0]] = new_list
                    plugin[pair[0]].append(pair[1])
                else:
                    plugin[pair[0]] = pair[1]
        try:
            plugins.append(plugin)
        except AttributeError:
            print(
                'mixing commandline plugins and configfile does not work with the old config file format'
                )
    return config
