comefrom: <qiyuangong>366_Find_Leaves_of_Binary_Tree_1.py
code: def findLeaves( root):
      res = []
      if root is None:
          return []
      stack = [root]
      check_set = set()
      while len(stack) > 0:
          curr = stack.pop()
          check_set.add(curr)
          if curr.left:
              stack.append(curr.left)
          if curr.right:
              stack.append(curr.right)
      while len(check_set) > 0:
          curr = []
          for node in check_set:
              if (node.left is None or node.left not in check_set) and\
                 (node.right is None or node.right not in check_set):
                  curr.append(node)
          res.append([node.val for node in curr])
          for node in curr:
              check_set.remove(node)
      return res
masked: def sample_funcname ( var_0 ) :
      var_1 = [ ]
      if var_0 is None :
          return [ ]
      var_3 = [ var_0 ]
      var_5 = set ( )
      while len ( var_3 ) > 0 :
          var_9 = var_3.pop ( )
          var_5.add ( var_9 )
          if var_9.left :
              var_3.append ( var_9.left )
          if var_9.right :
              var_3.append ( var_9.right )
      while len ( var_5 ) > 0 :
          var_9 = [ ]
          for var_14 in var_5 :
              if ( var_14.left is None or var_14.left not in var_5 ) and ( var_14.right is None or var_14.right not in var_5 ) :
                  var_9.append ( var_14 )
          var_1.append ( [ var_14.val for var_14 in var_9 ] )
          for var_14 in var_9 :
              var_5.remove ( var_14 )
      return var_1
  