def _retry_on_deadlock(exc):
 if isinstance(exc, db_exception.DBDeadlock):
  LOG.warn(_LW('Deadlock detected. Retrying...'))
  return True
 return False

def _retry_on_deadlock ( exc ) : if isinstance ( exc , db_exception . DBDeadlock ) : LOG . warn ( _LW ( 'Deadlock detected. Retrying...' ) ) return True return False
decorator to retry a db api call if deadlock was received .