from typing import List
from typing import Dict


def __find_in_tree(lst: List, ident: str) -> Dict:
    """
    Recursively search the tree of range results and find the one that has been requested.

    :param lst: A list of ranges or canvases
    :param ident: The "needle" identifier we are trying to find
    :return: A dictionary result or None if not found.
    """
    res: Dict = {}

    for itm in lst:
        if itm['id'] == ident:  # pylint: disable-msg=no-else-return
            return itm

        elif itm['type'] == 'Range' and itm.get('items'):
            res = __find_in_tree(itm.get('items'), ident)
            # added check if res was successful to break out of the recursion
            if res:
                return res

    return res