def _handle(self, data):
            """
            Handles a work request.
            """
            try:
                _logger().log(1, 'handling request %r', data)
                assert data['worker']
                assert data['request_id']
                assert data['data'] is not None
                response = {'request_id': data['request_id'], 'results': []}
                try:
                    worker = import_class(data['worker'])
                except __HOLE__:
                    _logger().exception('Failed to import worker class')
                else:
                    if inspect.isclass(worker):
                        worker = worker()
                    _logger().log(1, 'worker: %r', worker)
                    _logger().log(1, 'data: %r', data['data'])
                    try:
                        ret_val = worker(data['data'])
                    except Exception:
                        _logger().exception(
                            'something went bad with worker %r(data=%r)',
                            worker, data['data'])
                        ret_val = None
                    if ret_val is None:
                        ret_val = []
                    response = {'request_id': data['request_id'],
                                'results': ret_val}
                finally:
                    _logger().log(1, 'sending response: %r', response)
                    try:
                        self.send(response)
                    except ConnectionAbortedError:
                        pass
            except:
                _logger().warn('error with data=%r', data)
                exc1, exc2, exc3 = sys.exc_info()
                traceback.print_exception(exc1, exc2, exc3, file=sys.stderr)
dataset/ETHPy150Open OpenCobolIDE/OpenCobolIDE/open_cobol_ide/extlibs/pyqode/core/backend/server.py/JsonServer._Handler._handle