2020-09-17 12:09:59 +00:00
|
|
|
from benedict.core import clone
|
2020-02-03 17:25:54 +00:00
|
|
|
from benedict.utils import type_util
|
|
|
|
|
|
|
|
|
|
|
|
def subset(d, keys, *args):
|
2020-09-17 12:09:59 +00:00
|
|
|
new_dict = clone(d, empty=True)
|
2020-02-03 17:25:54 +00:00
|
|
|
if type_util.is_string(keys):
|
|
|
|
keys = [keys]
|
|
|
|
keys += args
|
|
|
|
for key in keys:
|
|
|
|
new_dict[key] = d.get(key, None)
|
|
|
|
return new_dict
|