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
          """
          if kwargs.get("debug"):
              log.setLevel(logging.DEBUG)
          conn = self.conn
          if namespace and namespace != self.namespace:
              conn = self.tstore.get_namespace(namespace)
          else:
              namespace = self.namespace
          if rtn_format not in self.qry_results_formats:
              raise KeyError("rtn_format was '%s'. Allowed values are %s" % \
                             (rtn_format, self.qry_results_formats))
          if not sparql.strip().lower().startswith("prefix"):
              sparql = "%s\n%s" % (NSM.prefix(), sparql)
          start = datetime.datetime.now()
          if mode == "get":
              try:
                  result = json.loads( \
                           conn.query(sparql).serialize(\
                           format=rtn_format).decode()).get('results',
                                                            {}).get('bindings', [])
              except:
                  print(sparql)
                  raise
          if mode == "update":
              try:
                  result = conn.update(sparql)
              except:
                  print(sparql)
                  raise
          log.debug("\nmode='%s', namespace='%s', rtn_format='%s'\n**** SPAQRL QUERY \n%s\nQuery Time: %s",
                    mode,
                    namespace,
                    rtn_format,
                    sparql,
                    (datetime.datetime.now()-start))
          return result