Executes the specified `sql` query and returns the cursor

def _query(self, sql, *args):
      """ Executes the specified `sql` query and returns the cursor """
      if not self._con:
          logger.debug(("Open MBTiles file '%s'") % self.filename)
          self._con = sqlite3.connect(self.filename)
          self._cur = self._con.cursor()
      sql = ' '.join(sql.split())
      logger.debug(("Execute query '%s' %s") % (sql, args))
      try:
          self._cur.execute(sql, *args)
      except (sqlite3.OperationalError, sqlite3.DatabaseError) as e:
          raise InvalidFormatError(("%s while reading %s") % (e, self.filename))
      return self._cur