def catch_ioerror(meth):
 @wraps(meth)
 def wrapper(self, *args, **kwargs):
  try:
   return meth(self, *args, **kwargs)
  except IOError as (errno, strerror):
   if (errno == ENOSPC):
    msg = 'No space left on device'
    raise ScanMustStopByKnownReasonExc(msg)
 return wrapper

def catch_ioerror ( meth ) : @ wraps ( meth ) def wrapper ( self , * args , ** kwargs ) : try : return meth ( self , * args , ** kwargs ) except IOError as ( errno , strerror ) : if ( errno == ENOSPC ) : msg = 'No space left on device' raise ScanMustStopByKnownReasonExc ( msg ) return wrapper
function to decorate methods in order to catch ioerror exceptions .