def _wrap_with_before(action, responder):
 if ('resource' in get_argnames(action)):
  shim = action
 else:
  def shim(req, resp, resource, kwargs):
   action(req, resp, kwargs)
 @wraps(responder)
 def do_before(self, req, resp, **kwargs):
  shim(req, resp, self, kwargs)
  responder(self, req, resp, **kwargs)
 return do_before

def _wrap_with_before ( action , responder ) : if ( 'resource' in get_argnames ( action ) ) : shim = action else : def shim ( req , resp , resource , kwargs ) : action ( req , resp , kwargs ) @ wraps ( responder ) def do_before ( self , req , resp , ** kwargs ) : shim ( req , resp , self , kwargs ) responder ( self , req , resp , ** kwargs ) return do_before
execute the given action function before a responder method .