code: def test_wait_first_exception(self):
      dv = self.client[:]
  
      def fail(i):
          print(i)
          import time
  
          if i == 0:
              print(1 / i)
          time.sleep(1)
          return i
  
      dv.scatter("rank", range(len(dv)), flatten=True, block=True)
      amr = dv.apply_async(fail, ipp.Reference("rank"))
      tic = time.perf_counter()
      done, pending = amr.wait(
          timeout=5, return_when=ipp.FIRST_EXCEPTION
      )
      assert done
      assert len(done) == 1
      first_done = done.pop()
      assert first_done.msg_ids == amr.msg_ids[:1]
      assert amr.wait(timeout=10) == True
      done, pending = amr.wait(
          timeout=0, return_when=ipp.FIRST_EXCEPTION
      )
      assert pending == set()
      assert len(done) == len(amr)
  
imports: import os
  import time
  from datetime import datetime
  import pytest
  from IPython.utils.io import capture_output
  import ipyparallel
  from ipyparallel import error
  from .clienttest import ClusterTestCase, raises_remote
label_desc: Use image node_id 36 for calling the TestAsyncResult obj's underlying member method code with example usage: obj.test_wait_first_exception() and returns: i