Valid Binary Search Tree Leetcode Solution Python