Balanced Binary Tree

class Solution:
    def isBalanced(self, root: Optional[TreeNode]) -> bool:
        
        def get_height(node):
            if not node:
                return 0
            
            lheight = get_height(node.left)
            if lheight == -1:
                return -1
            
            rheight = get_height(node.right)
            if rheight == -1:
                return -1
            
            if abs(lheight - rheight) > 1:
                return -1
            
            return 1 + max(lheight, rheight)
        
        return get_height(root) != -1