def reraise_as_retryrequest(f):
 @six.wraps(f)
 def wrapped(*args, **kwargs):
  try:
   return f(*args, **kwargs)
  except Exception as e:
   with excutils.save_and_reraise_exception() as ctx:
    if is_retriable(e):
     ctx.reraise = False
     raise db_exc.RetryRequest(e)
 return wrapped

def reraise_as_retryrequest ( f ) : @ six . wraps ( f ) def wrapped ( * args , ** kwargs ) : try : return f ( * args , ** kwargs ) except Exception as e : with excutils . save_and_reraise_exception ( ) as ctx : if is_retriable ( e ) : ctx . reraise = False raise db_exc . RetryRequest ( e ) return wrapped
packs retriable exceptions into a retryrequest .