code: def test_synchronous(self):
      flag = Event()
      assert not flag.is_set()
  
      def closure():
          sleep(1)
          assert not flag.is_set()
          flag.set()
  
      torch._lazy.add_step_closure(closure)
      torch._lazy.mark_step()
  
      # should not get to this part before closure is finished running
      assert flag.is_set()
  
file_path: pytorch/test/lazy/test_step_closures.py
imports: from threading import Event
  from time import sleep
  import torch._lazy
  import torch._lazy.ts_backend
  from torch.testing._internal.common_utils import run_tests, TestCase
label_desc: Use image node_id 1 for calling the ClosuresTest obj's underlying member method code with example usage: obj.test_synchronous() without return types