def removeValue(self, a):
        """ Removes a value from the tree and keeps it balanced """
        node = self.findNode(a)
        if not node or not node.contains(a):
            return None
        # swap the value we want to delete with its inorder successor (always leaf)
        succ = self.findInorderSucc(node, a)
        self.__swapValues(node, a, succ, succ.values[0])
        # delete leaf node value
        succ.removeValue(a)
        # fix tree if needed
        self.__fixNodeRemove(succ)
        return self
 Removes a value from the tree and keeps it balanced 
recipes/Python/577898_23_Tree/recipe-577898.py