def _bstSearch( self, subtree, target ): """Helper method that recursively searches the tree for a target key.""" if subtree is None : # base case, not found return None elif target < subtree.key : # target is left of the subtree root. return self._bstSearch( subtree.left, target ) elif target > subtree.key : # target is right of the subtree root. return self._bstSearch( subtree.right,target ) else : # base case, found! return subtree