code: def test_as_completed(client):
      with client.get_executor() as e:
          N = 10
          fs = [e.submit(slowinc, i, delay=0.02) for i in range(N)]
          expected = set(range(1, N + 1))
  
          for f in as_completed(fs):
              res = f.result()
              assert res in expected
              expected.remove(res)
  
          assert not expected
  
imports: from __future__ import annotations
  import random
  from concurrent.futures import FIRST_COMPLETED, FIRST_EXCEPTION, Future, TimeoutError, as_completed, wait
  from time import sleep
  import pytest
  from tlz import take
  from distributed.event import Event
  from distributed.metrics import time
  from distributed.utils import CancelledError
  from distributed.utils_test import inc, slowadd, slowinc, throws, varying
label_desc: Use image node_id 3 for calling a global function with example usage: test_as_completed(client) without return types