human
Complete the below
def _retry_on_deadlock(f):

    ''''Decorator to retry a DB API call if Deadlock was received.'
    '''
 ... Write me a the Python code you requested?
assistant
#Here is the Python code you requested.
    @functools.wraps(f)
    def wrapped(*args, **kwargs):
        while True:
            try:
                return f(*args, **kwargs)
            except db_exc.DBDeadlock:
                LOG.warn(_("Deadlock    detected    when    running    '%(func_name)s':    Retrying..."), dict(func_name=f.__name__))
                time.sleep(0.5)
                continue
    functools.update_wrapper(wrapped, f)
    return wrapped