def _find_if_has_key(obj, key, of_type = None):
    """
    Recursively find all objects with a given key in a dictionary

    Args:
        obj: Dictionary to search
        key: Key to find
        of_type: [optional] Type of the referenced item
    
    Returns:
        List of all objects that contain an item with the given key and matching type
    """
    children = lambda item: [val for val in item.values() if isinstance(val, dict)]
    found = []
    stack = children(obj) 
    while len(stack) > 0:
        item = stack.pop()
        if key in item and (of_type is None or isinstance(item[key], of_type)):
            found.append(item)
        stack.extend(children(item))

    return found