Helper method which backwards-recursively searches for objects
    :param cls_type: class type of the object we are in search of
    :param node: object instance to start at
    :param index: number of the object to look for e.g <cls_type> num 1
    :param depth: current depth in the tree
    :param start_index: index to start with in children
    :return: object <index> of <cls_type>

def BackwardSearch(cls_type, node, index, depth=0, start_index=0):
    '''
    Helper method which backwards-recursively searches for objects
    :param cls_type: class type of the object we are in search of
    :param node: object instance to start at
    :param index: number of the object to look for e.g <cls_type> num 1
    :param depth: current depth in the tree
    :param start_index: index to start with in children
    :return: object <index> of <cls_type>
    '''
    counter = depth
    if isinstance(node, cls_type):
        counter += 1
        if counter == index:
            return node
    if node is None:
        return None
    else:
        children = node.GetChildrenIndexes()
        if len(children) == 0 and isinstance(node, cls_type):
            return counter
        else:
            children.reverse()
            for child in children:
                result = Search(
                    cls_type,
                    node.GetChild(child),
                    index,
                    depth=counter)
                if isinstance(result, int):
                    counter = result
                    if counter == index:
                        return node.GetChild(child)
                if isinstance(result, cls_type):
                    return result
            if isinstance(node, cls_type):
                if counter == index:
                    return node
                else:
                    return counter