def raise_conversion_error(function):
 @wraps(function)
 def result(self, value):
  try:
   return function(self, value)
  except struct.error as e:
   raise ConversionError(e.args[0])
 return result

def raise_conversion_error ( function ) : @ wraps ( function ) def result ( self , value ) : try : return function ( self , value ) except struct . error as e : raise ConversionError ( e . args [ 0 ] ) return result
wrap any raised struct .