class transaction(object):

    def __init__(self, retries=0):
        self.retries = retries

def __enter__(self):
    return self

def __exit__(self, exc_type, exc_val, traceback):
    pass

def execute(self, query):
    err = None
Encapsulating retries into `with` block