def pipefunc(db, keys, funcname, *args, **kw):
    """Runs a pipeline with the given funcname on each given key.
    This function is equivalent to:
        [db.funcname(k, *args, **kw) for k in keys]
    """
    p = db.pipeline()
    func = getattr(p, funcname)
    [func(k, *args, **kw) for k in keys]
    return p.execute()