from typing import Any
from typing import Iterable
from typing import Optional


def get_values_for_keys(
    obj: Any, keys: Iterable[Any], values: Optional[set] = None
) -> set:
    """Get all values for `keys` found in nested `obj`."""
    if not values:
        values = set()

    if isinstance(obj, dict):
        for k, v in obj.items():
            if k in keys:
                values.add(v)
            else:
                values = get_values_for_keys(obj=v, keys=keys, values=values)
    elif isinstance(obj, list):
        for element in obj:
            values = get_values_for_keys(obj=element, keys=keys, values=values)

    return values