code: def gen_request(self, request_type="json", token=None, set_batch=False,
                      batch_onerror=None):
  
          
  
          if request_type == "json":
  
              local_request = RequestJson()
  
          elif request_type == "xml":
  
              local_request = RequestXml()
  
          else:
  
              raise UnknownRequestType()
  
          if token is not None:
              local_request.set_auth_token(token)
  
          if set_batch:
              local_request.enable_batch(batch_onerror)
  
          return local_request
docs: Convenience method to quickly generate a token
  
          :param request_type: Type of request (defaults to json)
          :param token: Authentication token
          :param set_batch: Also set this request to batch mode?
          :param batch_onerror: Onerror-parameter for batch mode
          :return: The request