def apply_kwargs(func, **kwargs):
    new_kwargs = {}
    params = signature(func).parameters
    for param_name in params.keys():
        if param_name in kwargs:
            new_kwargs[param_name] = kwargs[param_name]
    return func(**new_kwargs)
Call *func* with kwargs, but only those kwargs that it accepts.
dataset/ETHPy150Open ottogroup/palladium/palladium/util.py/apply_kwargs