def METHOD_NAME(doc, key):
    if doc is not None:
        if key in doc:
            yield doc[key]
        for z in doc.items():
            v = z[1]
            if isinstance(v, dict):
                for item in METHOD_NAME(v, key):
                    yield item
            elif isinstance(v, list):
                for i in v:
                    for j in METHOD_NAME(i, key):
                        yield j