I have a BST and I am trying to write a function where the input is value of the node and output should be the index of the node. ValueError is raised for non-existing value