code: def current(instance: bool = True) -> Optional["IOLoop"]:
          
          try:
              loop = asyncio.get_event_loop()
          except (RuntimeError, AssertionError):
              if not instance:
                  return None
              raise
          try:
              return IOLoop._ioloop_for_asyncio[loop]
          except KeyError:
              if instance:
                  from tornado.platform.asyncio import AsyncIOMainLoop
  
                  current = AsyncIOMainLoop(make_current=True)  # type: Optional[IOLoop]
              else:
                  current = None
          return current
docs: Returns the current thread's `IOLoop`.
  
          If an `IOLoop` is currently running or has been marked as
          current by `make_current`, returns that instance.  If there is
          no current `IOLoop` and ``instance`` is true, creates one.
  
          .. versionchanged:: 4.1
             Added ``instance`` argument to control the fallback to
             `IOLoop.instance()`.
          .. versionchanged:: 5.0
             On Python 3, control of the current `IOLoop` is delegated
             to `asyncio`, with this and other methods as pass-through accessors.
             The ``instance`` argument now controls whether an `IOLoop`
             is created automatically when there is none, instead of
             whether we fall back to `IOLoop.instance()` (which is now
             an alias for this method). ``instance=False`` is deprecated,
             since even if we do not create an `IOLoop`, this method
             may initialize the asyncio loop.