def command(self, imap_command):
        """
        Process an IMAP command we received from the client.

        We use introspection to find out what IMAP commands this handler
        actually supports.

        Arguments:
        - `imap_command`: An instance parse.IMAPClientCommand
        """
        self.debug_log_cmd(imap_command)

        # Since the imap command was properly parsed we know it is a valid
        # command. If it is one we support there will be a method
        # on this object of the format "do_%s" that will actually do the
        # command.
        #
        # If no such method exists then this is not a supported command.
        #
        self.tag = imap_command.tag
        if not hasattr(self, 'do_%s' % imap_command.command):
            self.client.push("%s BAD Sorry, %s is not a supported "
                             "command\r\n" % (imap_command.tag,
                                              imap_command.command))
            return

        # Okay. The command was a known command. Process it. Each 'do_' method
        # will send any messages back to the client specific to that command
        # except the "OK" response and any exceptional errors which are handled
        # by this method.
        #
        start_time = time.time()
        try:
            result = getattr(self, 'do_%s' % imap_command.command)(imap_command)
        except No, e:
            result = "%s NO %s\r\n" % (imap_command.tag, str(e))
            self.client.push(result)
            self.log.debug(result)
            return
        except Bad, e:
            result = "%s BAD %s\r\n" % (imap_command.tag, str(e))
            self.client.push(result)
            self.log.debug(result)
            return
        except MailboxLock, e:
            self.log.warn("Unable to get lock on mailbox '%s', putting on to command queue" % e.mbox.name)
            e.mbox.command_queue.append((self, imap_command))
            return
        except __HOLE__:
            sys.exit(0)
        except Exception, e:
            result = "%s BAD Unhandled exception: %s\r\n" % (imap_command.tag,
                                                             str(e))
            self.client.push(result)
            self.log.debug(result)
            raise

        # If there was no result from running this command then everything went
        # okay and we send back a final 'OK' to the client for processing this
        # command.
        #
        if result is None:
            result = "%s OK %s completed\r\n" % (imap_command.tag,
                                                 imap_command.command.upper())
            self.client.push(result)
            # self.log.debug(result)
        elif result is False:
            # Some commands do NOT send an OK response immediately.. aka the
            # IDLE command and commands that are being processed in multiple
            # runs (see 'command_queue' on the mailbox). If result is false
            # then we just return. We do not send a message back to our client.
            #
            return
        else:
            # The command has some specific response it wants to send back as
            # part of the tagged OK response.
            #
            result = "%s OK %s %s completed\r\n" % \
                     (imap_command.tag, result,
                      imap_command.command.upper())
            self.client.push(result)
            # self.log.debug(result)
        return

    ##################################################################
    #
dataset/ETHPy150Open scanner/asimap/asimap/client.py/BaseClientHandler.command