<prompt> Kuzalisha kazi ya kuangalia kama mti binary ni usawa au la.  <response>: Here is a Python function that checks whether a binary tree is balanced or not by calculating the height of the left and right subtrees at each node and ensuring that the height difference is not more than one:pythondef isBalancedroot: def checkHeightnode: if node is None: return 0 left_height checkHeightnode.left right_height checkHeightnode.right if left_height -1 or right_height -1: return -1 if absleft_height -right_height1: return -1 return maxleft_height, right_height1 return checkHeightroot ! -1This function takes a tree root node as an input and returns True if the tree is balanced and False otherwise.The function uses a recursive helper function, checkHeight, that computes the height of the left and right subtrees of each node and returns -1 if the tree is not balanced. If the checkHeight function returns -1 at any point, the overall isBalanced function will return False. Otherwise, it returns True. 