code: def test_event_sync(client):
      # Assert that we call the client.sync correctly
      def wait_for_it_failing(x):
          event = Event("x")
  
          # Event is not set in another task so far
          assert not event.wait(timeout=0.05)
          assert not event.is_set()
  
      def wait_for_it_ok(x):
          event = Event("x")
  
          # Event is set in another task
          assert event.wait(timeout=0.5)
          assert event.is_set()
  
      def set_it():
          event = Event("x")
          event.set()
  
      wait_futures = client.map(wait_for_it_failing, range(10))
      client.gather(wait_futures)
  
      set_future = client.submit(set_it)
      client.gather(set_future)
  
      wait_futures = client.map(wait_for_it_ok, range(10))
      client.gather(wait_futures)
  
imports: from __future__ import annotations
  import pickle
  from datetime import timedelta
  import pytest
  from distributed import Client, Event
  from distributed.utils_test import gen_cluster
label_desc: Use image node_id 1 for calling a global function with example usage: test_event_sync(client) without return types