def cleanup(self):
        """
        This cleans up various references and resources held open by this
        client.

        The code was collected here because it is called when a client logs out
        or when the main server closes the connection to us.
        """
        # Be sure to remove our entry from the server.clients dict. Also go
        # through all of the active mailboxes and make sure the client
        # unselects any if it had selections on them.
        #
        if self.server.clients in self.port:
            del self.server.clients[self.port]
        for mbox in self.server.active_mailboxes.itervalues():
            mbox.unselected(self.cmd_processor)

        # If the user server has no more clients then start the idle timeout
        # clock
        #
        if len(self.server.clients) == 0:
            self.log.debug("cleanup(): Server has no clients, starting "
                           "timeout clock")
            self.expiry = time.time() + 1800

        return


##################################################################
##################################################################
#
dataset/ETHPy150Open scanner/asimap/asimap/user_server.py/IMAPUserClientHandler.cleanup/swapped operands of `in`