docs: def _query(self, action, qobj):
          """
          returns WPToolsQuery string
          """
          title = self.params.get('title')
          pageid = self.params.get('pageid')
          wikibase = self.params.get('wikibase')
  
          qstr = None
  
          if action == 'random':
              qstr = qobj.random()
          elif action == 'query':
              qstr = qobj.query(title, pageid, self._continue_params())
          elif action == 'querymore':
              qstr = qobj.querymore(title, pageid, self._continue_params())
          elif action == 'parse':
              qstr = qobj.parse(title, pageid)
          elif action == 'imageinfo':
              qstr = qobj.imageinfo(self._missing_imageinfo())
          elif action == 'labels':
              qstr = qobj.labels(self._pop_entities())
          elif action == 'wikidata':
              qstr = qobj.wikidata(title, wikibase)
          elif action == 'restbase':
              qstr = qobj.restbase(self.params.get('rest_endpoint'), title)
  
          if qstr is None:
              raise ValueError("Unknown action: %s" % action)
  
          return qstr