def expunge(self):
        """
        Delete messages marked for deletion.

        @return: A L{list} of deleted message IDs.
        """
        delete = []
        for i in self.messages:
            if '\\Deleted' in i[1]:
                delete.append(i)
        for i in delete:
            self.messages.remove(i)
        return [i[3] for i in delete]

        Delete messages marked for deletion.

        @return: A L{list} of deleted message IDs.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/mail/test/test_imap.py