code: def test_exc_multiple_waits():
      def multiple_waits(waitall=False):
          # Test calling failed op followed by wait_to_read or waitall twice
          # Intention is to test rethrow for multiple wait_to_reads and waitalls
          # for vars with exceptions in same scope
          caught = False
          try:
              a = mx.nd.random.normal(0, -1, (2, 2)).copyto(
                  default_device()
              )
              if waitall:
                  mx.nd.waitall()
              else:
                  a.wait_to_read()
          except MXNetError:
              caught = True
          assert (
              caught
          ), "No exception thrown, exception should be rethrown with wait_to_read/waitall"
          try:
              b = mx.nd.random.normal(0, -1, (2, 2)).copyto(
                  default_device()
              )
              if waitall:
                  mx.nd.waitall()
              else:
                  b.wait_to_read()
          except MXNetError:
              caught = True
          assert (
              caught
          ), "No exception thrown, exception should be rethrown with wait_to_read/waitall"
  
      multiple_waits(waitall=False)
      multiple_waits(waitall=True)
  
file_path: mxnet/tests/python/unittest/test_exc_handling.py
imports: import os
  import mxnet
  import numpy
  from mxnet import gluon
  from mxnet.gluon import nn
  from mxnet.base import MXNetError
  from mxnet.test_utils import assert_exception, default_device, set_default_device, use_np
  import pytest
label_desc: Use image node_id 3 for calling a global function with example usage: test_exc_multiple_waits() without return types