Something like:
for (a,b) in kwargs.iteritems(): if not b : del kwargs[a]
This code raise exception because changing of dictionary when
You can also use filter:
filter
d = dict(a = 1, b = None, c = 3) filtered = dict(filter(lambda item: item[1] is not None, d.items())) print(filtered) {'a': 1, 'c': 3}