def wrap_instance_fault(function):
 @functools.wraps(function)
 def decorated_function(self, context, *args, **kwargs):
  try:
   return function(self, context, *args, **kwargs)
  except exception.InstanceNotFound:
   raise
  except Exception as e:
   kwargs.update(dict(zip(function.func_code.co_varnames[2:], args)))
   with excutils.save_and_reraise_exception():
    compute_utils.add_instance_fault_from_exc(context, self.conductor_api, kwargs['instance'], e, sys.exc_info())
 return decorated_function

def wrap_instance_fault ( function ) : @ functools . wraps ( function ) def decorated_function ( self , context , * args , ** kwargs ) : try : return function ( self , context , * args , ** kwargs ) except exception . InstanceNotFound : raise except Exception as e : kwargs . update ( dict ( zip ( function . func_code . co_varnames [ 2 : ] , args ) ) ) with excutils . save_and_reraise_exception ( ) : compute_utils . add_instance_fault_from_exc ( context , self . conductor_api , kwargs [ 'instance' ] , e , sys . exc_info ( ) ) return decorated_function
wraps a method to catch exceptions related to instances .