def get_rc_exc(rc):
 try:
  return rc_exc_cache[rc]
 except KeyError:
  pass
 if (rc > 0):
  name = ('ErrorReturnCode_%d' % rc)
  base = ErrorReturnCode
 else:
  signame = SIGNAL_MAPPING[abs(rc)]
  name = ('SignalException_' + signame)
  base = SignalException
 exc = ErrorReturnCodeMeta(name, (base,), {'exit_code': rc})
 rc_exc_cache[rc] = exc
 return exc

def get_rc_exc ( rc ) : try : return rc_exc_cache [ rc ] except KeyError : pass if ( rc > 0 ) : name = ( 'ErrorReturnCode_%d' % rc ) base = ErrorReturnCode else : signame = SIGNAL_MAPPING [ abs ( rc ) ] name = ( 'SignalException_' + signame ) base = SignalException exc = ErrorReturnCodeMeta ( name , ( base , ) , { 'exit_code' : rc } ) rc_exc_cache [ rc ] = exc return exc
takes a exit code or negative signal number and produces an exception that corresponds to that return code .