Deep Filter a Nested Object by Key-Value Predicate
Write a function that takes a deeply nested object and a predicate function, and returns a new object containing only the key-value pairs (at any depth) that satisfy the predicate. Non-matching keys should be pruned from the output, but their parent objects should be retained if they contain at least one matching descendant. This is useful for permission-based data masking, nested config filtering, and partial state selection in UI frameworks.