code: def syncify(f):
      """Given a function `f` that must be run on `TestAsync.loop`, queue `f` on
      the loop, block until it is evaluated, and return the result.
      """
      sem = queue.Queue()
  
      def _syncify_task():
          assert (
              threading.current_thread().ident == TestAsync.thread.ident
          )
          result = f()
          TestAsync.loop.add_callback(lambda: sem.put(result))
  
      def _syncify():
          TestAsync.loop.add_callback(_syncify_task)
          return sem.get()
  
      return _syncify
  
imports: import queue
  import random
  import threading
  from functools import partial
  import tornado.ioloop
  from perspective import PerspectiveError, PerspectiveManager, Table
  from pytest import raises
label_desc: Use image node_id 1 for calling a global function with example usage: syncify(f) and returns: _syncify, sem