code: def __clear_references(self, request, remove_request=True):
          
          # remove request itself
          if remove_request:
              with self.__requests:
                  self.__requests.pop(request.id_)
          # remove request type specific references
          if not request.success:
              with self.__pending_subs:
                  self.__pending_subs.pop(request.id_, None)
              with self.__pending_controls:
                  self.__pending_controls.pop(request.id_, None)
docs: Remove any internal references to the given request