def get_values_matching_key(doc, key):
    """
    Returns iterator of values in 'doc' with the matching 'key'.
    """

    def _get_values(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 _get_values(v, key):
                        yield item
                elif isinstance(v, list):
                    for i in v:
                        for j in _get_values(i, key):
                            yield j

    return _get_values(doc, key)