comefrom: <doocs>1457.Pseudo-Palindromic Paths in a Binary Tree_1.py
code: def dfs(root):
      if root is None:
          return
      nonlocal ans, counter
      counter[root.val] += 1
      if root.left is None and root.right is None:
          if sum(1 for i in range(1, 10) if counter[i] % 2 == 1) < 2:
              ans += 1
      else:
          dfs(root.left)
          dfs(root.right)
      counter[root.val] -= 1
masked: def sample_funcname ( var_1 ) :
      if var_1 is None :
          return
      nonlocal var_3 , var_4
      var_4 [ var_1.val ] += 1
      if var_1.left is None and var_1.right is None :
          if sum ( 1 for var_12 in range ( 1 , 10 ) if var_4 [ var_12 ] % 2 == 1 ) < 2 :
              var_3 += 1
      else :
          var_0 ( var_1.left )
          var_0 ( var_1.right )
      var_4 [ var_1.val ] -= 1
  