def pick_context_manager_writer(f):
 @functools.wraps(f)
 def wrapped(context, *args, **kwargs):
  ctxt_mgr = get_context_manager(context)
  with ctxt_mgr.writer.using(context):
   return f(context, *args, **kwargs)
 return wrapped

def pick_context_manager_writer ( f ) : @ functools . wraps ( f ) def wrapped ( context , * args , ** kwargs ) : ctxt_mgr = get_context_manager ( context ) with ctxt_mgr . writer . using ( context ) : return f ( context , * args , ** kwargs ) return wrapped
decorator to use a writer db context manager .