from typing import Dict
from typing import Any
from typing import Optional


def get_dict_value(
    profile: Dict[str, Any], *keys: str, default: Optional[Any] = None
) -> Any:
    """Save function to get an item from a nested dict

    Arguments:
        profile: the dict to start with
        *keys: a list the keys to descent to the wanted item of the profile
        default: the value to return if a key does not exist. Defaults to None.

    Returns:
        the item
    """

    if not profile:
        return default

    for key in keys:
        if key in profile:
            profile = profile[key]

        else:
            return default

    return profile