comefrom: <qiyuangong>103_Binary_Tree_Zigzag_Level_Order_Traversal_1.py
code: def zigzagLevelOrder( root):
      if root is None:
          return []
      q = [[root]]
      for level in q:
          record = []
          for node in level:
              if node.left:
                  record.append(node.left)
              if node.right:
                  record.append(node.right)
          if record:
              q.append(record)
      res = []
      for index, level in enumerate(q):
          temp = [x.val for x in level]
          if index % 2 == 0:
              res.append(temp)
          else:
              res.append(temp[::-1])
      return res
masked: def sample_funcname ( var_0 ) :
      if var_0 is None :
          return [ ]
      var_1 = [ [ var_0 ] ]
      for var_2 in var_1 :
          var_3 = [ ]
          for var_4 in var_2 :
              if var_4.left :
                  var_3.append ( var_4.left )
              if var_4.right :
                  var_3.append ( var_4.right )
          if var_3 :
              var_1.append ( var_3 )
      var_5 = [ ]
      for var_6 , var_2 in enumerate ( var_1 ) :
          var_8 = [ var_7.val for var_7 in var_2 ]
          if var_6 % 2 == 0 :
              var_5.append ( var_8 )
          else :
              var_5.append ( var_8 [ : : - 1 ] )
      return var_5
  