code: def test_run_sync():
      async def foo():
          return 1
  
      foo_sync = run_sync(foo)
      assert foo_sync() == 1
      assert foo_sync() == 1
      ensure_event_loop().close()
  
      asyncio.set_event_loop(None)
      assert foo_sync() == 1
      ensure_event_loop().close()
  
      asyncio.run(foo())
  
file_path: jupyter_core/tests/test_utils.py
imports: from __future__ import annotations
  import asyncio
  import os
  import tempfile
  import pytest
  from jupyter_core.utils import deprecation, ensure_async, ensure_dir_exists, ensure_event_loop, run_sync
label_desc: Use image node_id 4 for calling a global function with example usage: test_run_sync() and returns: int