'Evaluate and send results back'

def run(self):

    log.info('Running    codeintel    eval    thread...')
    buf = ''
    log.debug('default    supported    commands:    %s', ',    '.join(self._default_handler.supportedCommands))
    while True:
        with self.queue_cv:
            try:
                request = self.queue.pop()
            except IndexError:
                self.queue_cv.wait()
                continue
        log.debug('doing    request    %r', request)
        try:
            self.active_request = request
            command = request.command
            try:
                builtin = self._builtin_commands[command]
            except KeyError:
                pass
            else:
                builtin(request)
                continue
            handlers = self._command_handler_map.get(command, [])[:]
            if (command in self._default_handler.supportedCommands):
                handlers.append(self._default_handler)
            for handler in handlers:
                if isinstance(handler, tuple):
                    try:
                        real_handler = handler[0]()
                    except Exception as ex:
                        log.exception('Failed    to    get    lazy    handler    for    %s', command)
                        real_handler = None
                    if (real_handler is None):
                        try:
                            self._command_handler_map['command'].remove(handler)
                        except ValueError:
                            pass
                        continue
                    for handlers in self._command_handler_map.values():
                        try:
                            handlers[handlers.index(handler)] = real_handler
                        except ValueError:
                            pass
                    handler = real_handler
                if handler.canHandleRequest(request):
                    handler.handleRequest(request, self)
                    break
            else:
                self.fail(request=request, msg=("Don't    know    how    to    handle    command    %s" % (command,)))
        except RequestFailure as e:
            self.fail(request=request, *e.args, **e.kwargs)
        except Exception as e:
            log.exception(e.message)
            self.exception(request=request, message=e.message)
        finally:
            self.active_request = None
