def logout(self):
        """
        Inform the server that we are done with the connection.

        This command is allowed in any state of connection.

        @rtype: L{Deferred}
        @return: A deferred whose callback will be invoked with None
        when the proper server acknowledgement has been received.
        """
        d = self.sendCommand(Command(b'LOGOUT', wantResponse=(b'BYE',)))
        d.addCallback(self.__cbLogout)
        return d

        Inform the server that we are done with the connection.

        This command is allowed in any state of connection.

        @rtype: L{Deferred}
        @return: A deferred whose callback will be invoked with None
        when the proper server acknowledgement has been received.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/mail/imap4.py