def run_query(self, db, query):
        """Run a query and returns a dictionary with results"""
        try:
            cursor = db.cursor()
            cursor.execute(query)
            metric = {}
            for entry in cursor:
                try:
                    metric[entry[0]] = float(entry[1])
                except __HOLE__ as e:
                    metric[entry[0]] = entry[1]

            return metric
        except MySQLdb.OperationalError as message:
            self.checks_logger.debug(
                'mysql: MySQL query error when getting metrics = '.format(
                    message)
                )
dataset/ETHPy150Open serverdensity/sd-agent-plugins/MySQL/MySQL.py/MySQL.run_query