def _find_children(filter_fn, include_parents, include_children, find_fn, depth, node):
    if (depth is not None):
        depth -= 1
        if (depth < 0):
            return ([node] if filter_fn(node) else [])
    if ((not include_children) and filter_fn(node)):
        return [node]
    node_list = []
    for child in node._children:
        node_list.extend(find_fn(find_fn, depth, child))
    if ((include_parents or (not node_list)) and filter_fn(node)):
        node_list.insert(0, node)
    return node_list
def _find_children(filter_fn, include_parents, include_children, find_fn, depth, node):
    if (depth is not None):
        depth -= 1
        if (depth < 0):
            return ([node] if filter_fn(node) else [])
    if ((not include_children) and filter_fn(node)):
        return [node]
    node_list = []
    for child in node._children:
        node_list.extend(find_fn(find_fn, depth, child))
    if ((include_parents or (not node_list)) and filter_fn(node)):
        node_list.insert(0, node)
    return node_list