def gen_dict_key_matches(key, dictionary, _path=None, full_path=False):
    """ Generates a list of sets of (path, value) where path is a list of keys to access the given value in the given
        nested dictionary

    :param key: object, given dictionary key we are looking for
    :param dictionary: dict, query dictionary
    :param _path: list(str), internal use for the current path to output in case of match.
    :param full_path: bool, return value or (path, value))
    :return: Generator[object] or Generator[(list(str), object)], generator of (path, value) or just value
    """
    if _path is None:
        _path = []
    for k, v in iteritems(dictionary):
        _path.append(k)
        if k == key:
            yield (_path, v) if full_path else v
        elif isinstance(v, dict):
            for result in gen_dict_key_matches(key, v, _path):
                yield result