Extract recursive dict filtering to deep_filter() function