def only_if(f):
    """
    Marks usecases of a plugin.
    The plugin will only be used if f(for_) returns True,
    where for_ is a dictionary passed to PluginDiscoverer._get_implementation()
    :param f: function to check whether this plugin should be used or not.
    :type f: function
    :return: decorator function
    :rtype: function
    """
    def wrapper(cls):
        cls._plugin_should_be_used = staticmethod(f)
        return cls
    return wrapper