'@param box: an L{AmpBox} with a value for its L{COMMAND} and L{ASK}
keys.'

def _commandReceived(self, box):

    def formatAnswer(answerBox):
        answerBox[ANSWER] = box[ASK]
        return answerBox
    def formatError(error):
        if error.check(RemoteAmpError):
            code = error.value.errorCode
            desc = error.value.description
            if isinstance(desc, unicode):
                desc = desc.encode('utf-8', 'replace')
            if error.value.fatal:
                errorBox = QuitBox()
            else:
                errorBox = AmpBox()
        else:
            errorBox = QuitBox()
            log.err(error)
            code = UNKNOWN_ERROR_CODE
            desc = 'Unknown    Error'
        errorBox[ERROR] = box[ASK]
        errorBox[ERROR_DESCRIPTION] = desc
        errorBox[ERROR_CODE] = code
        return errorBox
    deferred = self.dispatchCommand(box)
    if (ASK in box):
        deferred.addCallbacks(formatAnswer, formatError)
        deferred.addCallback(self._safeEmit)
    deferred.addErrback(self.unhandledError)
