def get_leaf(tree):
    """
    get all leaves of tree.
    """
    if tree.is_leaf():
        return list()

    leaves = list()
    
    for sub_tree in [tree.get_left(), tree.get_right()]:
        if sub_tree:
            if sub_tree.is_leaf():
                leaves.append(sub_tree.id)
            else:
                leaves.extend(
                    get_leaf(sub_tree)
                )
    
    return leaves