def _p_append(self):

        self._p_simple_string(' ',
                              syntax_error = "expected ' ' after APPEND")
        self.mailbox_name = self._p_mailbox()
        self._p_simple_string(' ',
                              syntax_error = "expected ' ' after mailbox")

        # Now we have two optional arguments and a last required argument. How
        # do we know what we have next? Well, the first optional argument is a
        # flag list. This means it will begin with '('. The second optional
        # argument is a date_time, which must begin with a '"'. The final
        # argument is a string literal which means it begins with '{'. Since
        # the rfc states that they are specified in this order we can basically
        # check for each one to decide what to do next.
        #

        # Is this a list? If so, parse our list of flags.
        #
        self.flag_list = []
        if self._p_simple_string('(', silent = True, swallow = False):
            self.flag_list = self._p_paren_list_of(self._p_flag)
            self._p_simple_string(' ',
                                  syntax_error = "expected ' ' after flag " \
                                  "list")

        # The next thing is either a date_time or a string literal. If the next
        # character is a '"' then it must be a date time.
        #
        self.date_time = None
        if self._p_simple_string('"', silent = True, swallow = False):
            self.date_time = self._p_date_time()
            self._p_simple_string(' ', syntax_error = "expected ' ' after " \
                                  "rfc822 date-time")

        # and the last thing _must_ be a string literal, and it is an email
        # message so we are going to cut out the middle man and just parse it
        # as a message structure right away (I hope this works in all cases,
        # even with draft messages.)
        #
        self.message = email.message_from_string(self._p_string())
        return

    #######################################################################
    #
append ::= "APPEND" SPACE mailbox [SPACE flag_list]
dataset/ETHPy150Open scanner/asimap/asimap/parse.py/IMAPClientCommand._p_append