def prompt_toolkit_key_to_vt100_key(key, application_mode=False):
    """
    Turn a prompt toolkit key. (E.g Keys.ControlB) into a Vt100 key sequence.
    (E.g. \x1b[A.)
    """
    application_mode_keys = {
        Keys.Up: '\x1bOA',
        Keys.Left: '\x1bOD',
        Keys.Right: '\x1bOC',
        Keys.Down: '\x1bOB',
    }

    if key == '\n':
        return '\r'

    elif application_mode and application_mode_keys in key:
        return application_mode_keys.get(key)
    else:
        return _PROMPT_TOOLKIT_KEY_TO_VT100.get(key, key)
dataset/ETHPy150Open jonathanslenders/pymux/pymux/key_mappings.py/prompt_toolkit_key_to_vt100_key/swapped operands of `in`