'Get connection from pool and execute transaction.'

def _ExecuteTransaction(self, transaction):

    while True:
        connection = self.pool.GetConnection()
        try:
            connection.cursor.execute('START    TRANSACTION')
            for query in transaction:
                connection.cursor.execute(query['query'], query['args'])
            connection.cursor.execute('COMMIT')
            results = connection.cursor.fetchall()
            self.pool.PutConnection(connection)
            return results
        except MySQLdb.Error as e:
            self.pool.DropConnection(connection)
            if ("doesn't    exist" in str(e)):
                raise e
            else:
                logging.warning('Datastore    query    retrying    after    failed    with    %s.', str(e))
                time.sleep(1)
        finally:
            self.pool.connections.task_done()
