def METHOD_NAME(
    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. This functionality uses
    contextvars and requires at least Python 3.7.
    """
    if sys.version_info <= (3, 6):
        raise RuntimeError("Application sessions require Python 3.7.")
    # 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)