I had written a recursive function to find a value with given `dict` and `key`.
But I think there should be a more readable version. Here is the code block.

```
def findvalue(_dict, target):
    for key, values in _dict.items():
        if 'dict' in str(type(values)):
            return findvalue(values, target)
        elif key == target:
            return values
        else:
            print("no such key")

```

Is there any one line version of this or using yield(not sure about this)?

**Edit**: Based on [Recursive functions and lists appending/extending](https://stackoverflow.com/questions/9896951/recursive-functions-and-lists-appending-extending) and ideas from comments I modified the function to find all matched values by the given key

```
def find_all_value(_dict, target, values=None):
    for key, values in _dict.items():
        #case 1: it is a dictionary but not match the key
        if isinstance(values, dict) and key!=target:
            return find_all_value(values, target)
        #case 2: it is a dictionary but match the key -> put it in result
        elif isinstance(values, dict) and key==target:
            return [values] + find_all_value(values, target)
        #case 3: it is not dictionary and match the key -> put it in result
        elif key==target:
            return [values]

```