def isValidBSTHelper(self, root, minValue, maxValue):
    if (root is None):
        return True
    if ((root.left is None) and (root.right is None)):
        return (minValue < root.val < maxValue)
    if ((root.val <= minValue) or (root.val >= maxValue)):
        return False
    leftSubtreeIsValid = self.isValidBSTHelper(root.left, minValue, root.val)
    rightSubtreeIsValid = self.isValidBSTHelper(root.right, root.val, maxValue)
    return (leftSubtreeIsValid and rightSubtreeIsValid)
def isValidBSTHelper(self, root, minValue, maxValue):
    if (root is None):
        return True
    if ((root.left is None) and (root.right is None)):
        return (minValue < root.val < maxValue)
    if ((root.val <= minValue) or (root.val >= maxValue)):
        return False
    leftSubtreeIsValid = self.isValidBSTHelper(root.left, minValue, root.val)
    rightSubtreeIsValid = self.isValidBSTHelper(root.right, root.val, maxValue)
    return (leftSubtreeIsValid and rightSubtreeIsValid)