human
4.3 List of Depths
4.4 Check Balanced
Define a binary tree"
Please write code following the instructions in jupyter notebook style.

=====
Give me a code to 4?
assistant
#Here is code to 4.

class Node(object):
    def __init__(self, data=None):
        self.data = data
        self.left = None
        self.right = None

    def add_left(self, data):
        self.left = Node(data)
        
    def add_right(self, data):
        self.right = Node(data)

def getHeight(node):
    if node is None:
        return 0
    return 1 + max(getHeight(node.left), getHeight(node.right))

def isBalanced(node):
    if node is None:
        return True
    if abs(getHeight(node.left) - getHeight(node.right)) > 1:
        return False
    return isBalanced(node.left) and isBalanced(node.right)

root = Node('root')
root.left = Node("left")
root.right = Node("right")
root.left.left = Node("left 2")
root.left.right = Node("left-right")

getHeight(root)

isBalanced(root)