self right none self data data insert node def insert(selfdata)if self dataif data self dataif self left is noneself left node(dataelseself left insert(dataelif data self dataif self right is noneself right node(dataelseself right insert(dataelseself data data print the tree def printtree(self)if self leftself left printtree(printself data)if self rightself right printtree(inorder traversal left -root -right def inordertraversal(selfroot)res [if rootres self inordertraversal(root leftres append(root datares res self inordertraversal(root rightreturn res