()
| 1557 | # Use type() so that if in_tree is a VDict, out_tree is also a VDict. |
| 1558 | out_tree = type(in_tree)() |
| 1559 | for k, v in in_tree.items(): |
| 1560 | path = _concat(prefix=prefix, suffix=k, separator=separator) |
| 1561 | v = prune_tree(v, should_prune, prefix=path, separator=separator) |
| 1562 | if not should_prune(path, v): |
| 1563 | out_tree[k] = v |
| 1564 | in_tree = out_tree |
| 1565 | return in_tree |