def subtract(a, b):
    """ Remove the keys in b from a. """
for k in b:
    if k in a:
        if isinstance(b[k], dict):
            subtract(a[k], b[k])
else:
    del a[k]
Вычесть dict A из dict B (deep del)?