def _query(self, query_str, query_args=None, **query_options):
ret = True<EOL>connection = query_options.get('<STR_LIT>', None)<EOL>with self.connection(connection) as connection:<EOL><INDENT>cur = connection.cursor()<EOL>ignore_result = query_options.get('<STR_LIT>', False)<EOL>count_result = query_options.get('<STR_LIT>', False)<EOL>one_result = query_options.get('<STR_LIT>', query_options.get('<STR_LIT>', False))<EOL>cursor_result = query_options.get('<STR_LIT>', False)<EOL>try:<EOL><INDENT>if query_args:<EOL><INDENT>self.log("<STR_LIT>", query_str, os.linesep, query_args)<EOL>cur.execute(query_str, query_args)<EOL><DEDENT>else:<EOL><INDENT>self.log(query_str)<EOL>cur.execute(query_str)<EOL><DEDENT>if cursor_result:<EOL><INDENT>ret = cur<EOL><DEDENT>elif not ignore_result:<EOL><INDENT>if one_result:<EOL><INDENT>ret = self._normalize_result_dict(cur.fetchone())<EOL><DEDENT>elif count_result:<EOL><INDENT>ret = cur.rowcount<EOL><DEDENT>else:<EOL><INDENT>ret = self._normalize_result_list(cur.fetchall())<EOL><DEDENT><DEDENT><DEDENT>except Exception as e:<EOL><INDENT>self.log(e)<EOL>raise<EOL><DEDENT>return ret<EOL><DEDENT>
**query_options -- dict
    ignore_result -- boolean -- true to not attempt to fetch results
    fetchone -- boolean -- true to only fetch one result
    count_result -- boolean -- true to return the int count of rows affected