docs: def query(self,
                startTime=None,
                endTime=None,
                sinceServerStart=False,
                level="WARNING",
                services="*",
                machines="*",
                server="*",
                codes=[],
                processIds=[],
                export=False,
                exportType="CSV", #CSV or TAB
                out_path=None
                ):
          """
             The query operation on the logs resource provides a way to
             aggregate, filter, and page through logs across the entire site.
             Inputs:
  
          """
          allowed_levels = ("SEVERE", "WARNING", "INFO",
                            "FINE", "VERBOSE", "DEBUG")
          qFilter = {
              "services": "*",
              "machines": "*",
              "server" : "*"
          }
          if len(processIds) > 0:
              qFilter['processIds'] = processIds
          if len(codes) > 0:
              qFilter['codes'] = codes
          params = {
              "f" : "json",
              "sinceServerStart" : sinceServerStart,
              "pageSize" : 10000
          }
          if startTime is not None and \
             isinstance(startTime, datetime):
              params['startTime'] = startTime.strftime("%Y-%m-%dT%H:%M:%S")
          if endTime is not None and \
             isinstance(endTime, datetime):
              params['endTime'] = endTime.strftime("%Y-%m-%dT%H:%M:%S")
          if level.upper() in allowed_levels:
              params['level'] = level
          if server != "*":
              qFilter['server'] = server.split(',')
          if services != "*":
              qFilter['services'] = services.split(',')
          if machines != "*":
              qFilter['machines'] = machines.split(",")
          params['filter'] = qFilter
          if export == True and \
             out_path is not None:
              messages = self._post(self._url + "/query", params,
                                       securityHandler=self._securityHandler,
                                       proxy_url=self._proxy_url,
                                       proxy_port=self._proxy_port)
  
              with open(name=out_path, mode='wb') as f:
                  hasKeys = False
                  if exportType == "TAB":
                      csvwriter = csv.writer(f, delimiter='\t')
                  else:
                      csvwriter = csv.writer(f)
                  for message in messages['logMessages']:
                      if hasKeys == False:
                          csvwriter.writerow(message.keys())
                          hasKeys = True
                      csvwriter.writerow(message.values())
                      del message
              del messages
              return out_path
          else:
              return self._post(self._url + "/query", params,
                                   securityHandler=self._securityHandler,
                                   proxy_url=self._proxy_url,
                                   proxy_port=self._proxy_port)