from typing import Any


def find_key(d: dict, key: str) -> Any:
    """Finds a key nested arbitrarily deeply inside a dictself.

    Principally useful since the structure of NRPE relation data is
    not completely reliable.
    """
    if key in d:
        return d[key]
    for child in d.values():
        if not isinstance(child, dict):
            continue
        val = find_key(child, key)
        if val:
            return val