from typing import Callable
from typing import Any
from typing import Dict
import inspect


def filter_params(function: Callable[..., Any], data: Dict[str, Any]) -> Dict[str, Any]:
    """Filters parameters so that the function recieves only what it needs."""
    # Get the parameters
    params = inspect.getfullargspec(function)
    if params.varkw is not None:
        # The function recieves kwargs, return the full dictionary
        return data
    if not params.args:
        # The function does not recieve args, return an empty dict
        return {}
    # Filter every param whose key is not in the params dictionary
    return {k: v for k, v in data.items() if k in params.args}