docs: def query(self,
                sparql,
                mode="get",
                namespace=None,
                rtn_format="json",
                **kwargs):
          """
          Runs a sparql query and returns the results
  
          Args:
          -----
              sparql: the sparql query to run
              namespace: the namespace to run the sparql query against
              mode: ['get'(default), 'update'] the type of sparql query
              rtn_format: ['json'(default), 'xml'] format of query results
  
          Kwargs:
          -------
              debug(bool): If True sets logging level to debug
          """
          namespace = pick(namespace, self.namespace)
          if kwargs.get("log_level"):
              log.setLevel(kwargs['log_level'])
          if kwargs.get("debug"):
              log.setLevel(logging.DEBUG)
          if rtn_format not in self.qry_formats:
              raise KeyError("rtn_format was '%s'. Allowed values are %s" % \
                             (rtn_format, self.qry_results_formats))
          url = self._make_url(namespace)
          if 'prefix' not in sparql.lower():
              sparql = "%s\n%s" % (NSM.prefix(), sparql)
  
  
          if mode == "get":
  
              data = {"query": sparql} #, "format": rtn_format}
          elif mode == "update":
              data = {"update": sparql}
          else:
              raise NotImplementedError("'mode' != to ['get', 'update']")
  
          headers = {'Accept': self.qry_formats[rtn_format]}
          start = datetime.datetime.now()
          try:
              result = requests.post(url, data=data, headers=headers)
          except requests.exceptions.ConnectionError:
              result = requests.post(self._make_url(namespace, self.local_url),
                                     data=data,
                                     headers=headers)
          log.debug(format_multiline(["",
                                      "url='{url}'",
                                      """mode='{mode}', namespace='{namespace}',
                                      rtn_format='{rtn_format}'""",
                                      "**** SPAQRL QUERY ****",
                                      "",
                                      "{sparql}",
                                      "Query Time: {q_time}"],
                                     url=url,
                                     mode=mode,
                                     namespace=namespace,
                                     rtn_format=rtn_format,
                                     sparql=sparql,
                                     q_time=(datetime.datetime.now()-start),
                                     **kwargs))
  
          if result.status_code == 200:
              try:
                  if rtn_format == "json":
                      bindings = result.json().get('results',
                                                   {}).get('bindings', [])
                  elif rtn_format == 'xml':
                      xml_doc = etree.XML(result.text)
                      bindings = xml_doc.findall("results/bindings")
                  else:
                      bindings = result.text
                  try:
                      log.debug("result count: %s", len(bindings))
                  except TypeError:
                      pass
                  return bindings
              except json.decoder.JSONDecodeError:
                  if mode == 'update':
                      return BeautifulSoup(result.text, 'lxml').get_text()
                  return result.text
          else:
              raise SyntaxError("%s\n\n%s\n\n%s" % (sparql,
                      add_sparql_line_nums(sparql),
                      result.text[result.text.find("java."):]))