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


def extract_nested_value(root: Mapping, *args: str) -> Optional[Dict]:
    """
    Dig through a nested ``Dict`` gives the keys to use in order as arguments.
    Returns the final value if it exists else `None` if the tree ends at any point.
    """
    current_value: Any = root
    for arg in args:
        if not isinstance(current_value, dict):
            return None

        current_value = current_value.get(arg)

    return current_value