code: def create_app_session(
      input: Input | None = None, output: Output | None = None
  ) -> Generator[AppSession, None, None]:
      """
      Create a separate AppSession.
  
      This is useful if there can be multiple individual `AppSession`s going on.
      Like in the case of an Telnet/SSH server.
      """
      # If no input/output is specified, fall back to the current input/output,
      # whatever that is.
      if input is None:
          input = get_app_session().input
      if output is None:
          output = get_app_session().output
  
      # Create new `AppSession` and activate.
      session = AppSession(input=input, output=output)
  
      token = _current_app_session.set(session)
      try:
          yield session
      finally:
          _current_app_session.reset(token)
  
file_path: catboost/contrib/python/prompt-toolkit/py3/prompt_toolkit/application/current.py
imports: from __future__ import annotations
  from contextlib import contextmanager
  from contextvars import ContextVar
  from typing import TYPE_CHECKING, Any, Generator
label_desc: Use image node_id 5 for calling a global function with example usage: create_app_session(input, output) without return types