code: def is_valid(self):
          
  
          if not self:
              return True
  
          if self.left and self.data[self.axis] < self.left.data[self.axis]:
              return False
  
          if self.right and self.data[self.axis] > self.right.data[self.axis]:
              return False
  
          return all(c.is_valid() for c, _ in self.children) or self.is_leaf
docs: Checks recursively if the tree is valid
  
          It is valid if each node splits correctly