import inspect


def appropriate_kwargs(kwargs, func):
    """
    Auto get the appropriate kwargs according to those allowed by the func.
    Args:
        kwargs (dict): kwargs.
        func (object): function object.

    Returns:
        filtered_dict (dict): filtered kwargs.

    """
    sig = inspect.signature(func)
    filter_keys = [param.name for param in sig.parameters.values()
                   if param.kind == param.POSITIONAL_OR_KEYWORD and
                   param.name in kwargs.keys()]
    appropriate_dict = {filter_key: kwargs[filter_key]
                        for filter_key in filter_keys}
    return appropriate_dict