def append(self, mailbox, flags, date_time, message, **kw):
        """(typ, [data]) = append(mailbox, flags, date_time, message)
        Append message to named mailbox.
        All args except `message' can be None."""

        name = 'APPEND'
        if not mailbox:
            mailbox = 'INBOX'
        if flags:
            if (flags[0],flags[-1]) != ('(',')'):
                flags = '(%s)' % flags
        else:
            flags = None
        if date_time:
            date_time = Time2Internaldate(date_time)
        else:
            date_time = None
        if isinstance(message, str):
            message = bytes(message, 'ASCII')
        self.literal = self.mapCRLF_cre.sub(CRLF, message)
        try:
            return self._simple_command(name, mailbox, flags, date_time, **kw)
        finally:
            self._release_state_change()
dataset/ETHPy150Open OfflineIMAP/imapfw/imapfw/imap/imaplib3/imaplib2.py/IMAP4.append/original