get a sub-set of a python dictionary,dict([i for i in iter(d.items()) if i[0] in validkeys])