def METHOD_NAME(index):
    bst = {}
    bst[0] = ["\0", 0, 0, 0, "NULL"]
    begin = 1
    idx = end = entities_bst_create_tree(index, bst, begin)
    stack = []
    while True:
        while begin < end:
            if len(bst[begin][5]) != 0:
                index = bst[begin][5]
                bst[begin][5] = 0
                bst[begin][3] = idx
                stack.append([begin + 1, end])
                begin = idx
                end = idx = entities_bst_create_tree(index, bst, idx)
            else:
                begin = begin + 1
        if len(stack) == 0:
            break
        entry = stack.pop();
        begin = entry[0]
        end = entry[1]
    return bst