code: def __request_except(self, requestId, exc, set_and_forget=True):
          
          try:
              with self.__requests:
                  if set_and_forget:
                      req = self.__requests.pop(requestId)
                  else:
                      req = self.__requests[requestId]
          except KeyError:
              logger.error('Unknown request %s - cannot set exception', requestId)
          else:
              if exc is not None:
                  req.exception = exc
              if set_and_forget:
                  req._set()
docs: Set exception (if not None) for the given request and (optionally) remove from internal cache & setting its
             event