def METHOD_NAME(data: Any, path: str, result: dict):
    if isinstance(data, dict) and "__kind__" in data:
        kind = data["__kind__"]
        if kind == Kind.Instance:
            result[join(path, "()")] = data["class"]
            for n, arg in enumerate(data.get("args", [])):
                METHOD_NAME(arg, join(path, n), result)
            for name, value in data["kwargs"].items():
                METHOD_NAME(value, join(path, name), result)
        elif kind == Kind.Stateful:
            result[join(path, "!")] = data["class"]
            for name, value in data["kwargs"].items():
                METHOD_NAME(value, join(path, name), result)
        elif kind == Kind.Type:
            result[join(path, "#")] = data["class"]
        else:
            raise ValueError(f"Unsupported kind `{kind}`.")
    else:
        result[path] = data