code: def _parse_seq(self, p):
          
          # This basically says:
          #
          # - When you reach the end of the list, construct and return an empty
          #   deque.
          # - Otherwise, prepend to start of what you got from the parser.
          #
          # So this ends up constructing an in-order list.
          if len(p) == 4:
              p[3].appendleft(p[1])
              p[0] = p[3]
          elif len(p) == 3:
              p[2].appendleft(p[1])
              p[0] = p[2]
          elif len(p) == 1:
              p[0] = deque()
          else:
              raise ThriftParserError(
                  'Wrong number of tokens received for expression at line %d'
                  % p.lineno(1)
              )
docs: Helper to parse sequence rules.
  
          Sequence rules are in the form::
  
              foo : foo_item sep foo
                  | foo_item foo
                  |
  
          This function builds a deque of the items in-order.
  
          If the number of tokens doesn't match, an exception is raised.