code: def pruneTree(self, root: Optional[TreeNode]) -> Optional[TreeNode]:
      if not root:
          return None
  
      root.left = self.pruneTree(root.left)
      root.right = self.pruneTree(root.right)
  
      if root.left or root.right or root.val == 1:
          return root
      else:
          None
  
label_desc: Use image node_id 1 for calling the Solution obj's underlying member method code with example usage: obj.pruneTree(root) and returns: None, root