import asyncio


def invoke_plugins(plugins, func, *args):
    """
    Invokes an async function in parallel on all supplied plugins.

    :param plugins: a dict of plugins (name -> plugin)
    :param func: the name of the function to invoke if it exists
    :type func: str
    :param *args: the arguments to pass to the plugin function
    :returns: Future instance
    """
    asyncfuncs = [getattr(p, func)(*args) for p in plugins.values() if hasattr(p, func)]
    return asyncio.gather(*asyncfuncs)