from typing import Callable
import inspect


def subset_call(method: Callable, kwargs: dict):
    """
    Helper function to call a method with the intersection of arguments in the
    method signature and the supplied arguments.

    :param method:
        The method to be called.
    :param kwargs:
        The argument superset as a dictionary, similar to `**kwargs` in method
        signatures.
    :return:
        The output of `method`, called with the applicable arguments in
        `kwargs`.
    """
    method_args = inspect.signature(method).parameters
    subset_kwargs = {k: v
                     for k, v in kwargs.items()
                     if k in method_args}
    return method(**subset_kwargs)