from functools import reduce


def dict_get(d, k: str | list):
    """Recursive dictionary get."""

    if isinstance(k, str):
        k = k.split(".")

    if d[k[0]].value is None:
        return {}

    return reduce(lambda c, k: c.get(k, {}), k[1:], d[k[0]].value)