code: def exception_catcher(fn):
      
      exceptions = Queue.Queue()
  
      @wraps(fn)
      def wrapped(*args, **kwargs):
          try:
              ret = fn(*args, **kwargs)
          except Exception:
              exceptions.put(sys.exc_info())
              raise
          return ret
  
      def check():
          try:
              item = exceptions.get(block=False)
              klass, value, tb = item
              raise klass, value, tb
          except Queue.Empty:
              pass
  
      setattr(wrapped, 'check', check)
      return wrapped
docs: Catch exceptions raised by the decorated function.
          Call check() to raise any caught exceptions.