code: def _patch_asyncio():
      """Patch asyncio module to use pure Python tasks and futures."""
  
      def run(main, *, debug=False):
          loop = asyncio.get_event_loop()
          loop.set_debug(debug)
          task = asyncio.ensure_future(main)
          try:
              return loop.run_until_complete(task)
          finally:
              if not task.done():
                  task.cancel()
                  with suppress(asyncio.CancelledError):
                      loop.run_until_complete(task)
  
      def _get_event_loop(stacklevel=3):
          loop = events._get_running_loop()
          if loop is None:
              loop = events.get_event_loop_policy().get_event_loop()
          return loop
  
      # Use module level _current_tasks, all_tasks and patch run method.
      if hasattr(asyncio, "_nest_patched"):
          return
      if sys.version_info >= (3, 6, 0):
          asyncio.Task = (
              asyncio.tasks._CTask
          ) = asyncio.tasks.Task = asyncio.tasks._PyTask
          asyncio.Future = (
              asyncio.futures._CFuture
          ) = asyncio.futures.Future = asyncio.futures._PyFuture
      if sys.version_info < (3, 7, 0):
          asyncio.tasks._current_tasks = (
              asyncio.tasks.Task._current_tasks
          )
          asyncio.all_tasks = asyncio.tasks.Task.all_tasks
      if sys.version_info >= (3, 9, 0):
          events._get_event_loop = (
              events.get_event_loop
          ) = asyncio.get_event_loop = _get_event_loop
      asyncio.run = run
      asyncio._nest_patched = True
  
file_path: catboost/contrib/python/nest-asyncio/nest_asyncio.py
imports: import asyncio
  import asyncio.events
  import os
  import sys
  import threading
  from contextlib import contextmanager, suppress
  from heapq import heappop
label_desc: Use image node_id 2 for calling a global function with example usage: _patch_asyncio() and returns: loop, loop