def gen_dict_extract(key, var):
    if hasattr(var, 'iteritems'):
        for k, v in var.items():
            if k == key:
                yield v
if isinstance(v, dict):
    for result in gen_dict_extract(key, v):
        yield result
elif isinstance(v, list):
    for d in v:
        for result in gen_dict_extract(key, d):
            yield result
Find all occurences of a key in nested python dictionaries and lists