def do_close(self, cmd):
        if self.state != "selected":
            raise No("Client must be in the selected state")

        # We allow for the mailbox to be deleted.. it has no effect on this
        # operation.
        #
        self.pending_expunges = []
        self.state = "authenticated"
        mbox = None
        try:
            if self.mbox:
                self.mbox.unselected(self)
                mbox = self.mbox
                self.mbox = None

            # If the mailbox was selected via 'examine' then closing the
            # mailbox does NOT do a purge of all messages marked with '\Delete'
            #
            if self.examine:
                return

            # Otherwise closing the mailbox (unlike doing a 'select' 'examine'
            # or 'logout') will perform an expunge (just no messages will be
            # sent to this client.) We pass no client parameter so the expunge
            # does its work 'silently.'
            #
            if mbox:
                mbox.resync()
                mbox.expunge()
        except MailboxUnlock:
            pass
        return

    ##################################################################
    #
Generic main function for all the gnt-* commands.
dataset/ETHPy150Open scanner/asimap/asimap/client.py/Authenticated.do_close--crossover with--dataset/ETHPy150Open ganeti/ganeti/lib/cli.py/GenericMain