code: def process_cancel(self):
          
          self.log_response_message('got CANCEL message')
          # silly cases, nothing to do
          if not self.in_cancel:
              return
  
          while True:
              token_id = self.get_token_id()
              self.process_token(token_id)
              if not self.in_cancel:
                  return
docs: Process the incoming token stream until it finds
          an end token DONE with the cancel flag set.
          At that point the connection should be ready to handle a new query.
  
          In case when no cancel request is pending this function does nothing.