Mask applied on top of your data. Everything that is not whitelisted - will be removed from dict. Works with nested dicts and lists.
Usage:
-
Prepare your data
data = { "a": "A", "b": "B" }
-
Copy your data and prepare mask: True to keep field, False/None to remove
mask = { "a": True, "b": False }
-
Apply dictmask and check result
dictmask(data, mask) { "a": "A" }