def dict_prune_private(d):
    """Return a copy of a dict removing subtrees with keys starting with '_'."""
    
    if isinstance(d, dict):
        data = {}
        for key, value in d.items():
            if not key.startswith("_"):
                data[key] = dict_prune_private(value)
        return data
    else:
        return d