def wrap_instance_event(prefix):
 @utils.expects_func_args('instance')
 def helper(function):
  @functools.wraps(function)
  def decorated_function(self, context, *args, **kwargs):
   wrapped_func = safe_utils.get_wrapped_function(function)
   keyed_args = inspect.getcallargs(wrapped_func, self, context, *args, **kwargs)
   instance_uuid = keyed_args['instance']['uuid']
   event_name = '{0}_{1}'.format(prefix, function.__name__)
   with EventReporter(context, event_name, instance_uuid):
    return function(self, context, *args, **kwargs)
  return decorated_function
 return helper

def wrap_instance_event ( prefix ) : @ utils . expects_func_args ( 'instance' ) def helper ( function ) : @ functools . wraps ( function ) def decorated_function ( self , context , * args , ** kwargs ) : wrapped_func = safe_utils . get_wrapped_function ( function ) keyed_args = inspect . getcallargs ( wrapped_func , self , context , * args , ** kwargs ) instance_uuid = keyed_args [ 'instance' ] [ 'uuid' ] event_name = '{0}_{1}' . format ( prefix , function . __name__ ) with EventReporter ( context , event_name , instance_uuid ) : return function ( self , context , * args , ** kwargs ) return decorated_function return helper
wraps a method to log the event taken on the instance .