def key_release(key):
    """Simulates a key release event.

    Sends a scancode to the computer to report which key has been released.
    Some games use DirectInput devices, and respond only to scancodes, not
    virtual key codes. You can simulate DirectInput key releases using this
    method. A call to the key_release(...) method usually follows a call to
    the key_press(..) method of the same key.

    :param key: A string indicating which key to be released.
    """
    try:
        key_name = key.upper()
    except AttributeError:
        raise ValueError('invalid literal for key_release(): {}'.format(key))
    try:
        hex_code = KEYS[key_name]
    except KeyError:
        pass
    else:
        flags = KEYEVENTF_SCANCODE | win32con.KEYEVENTF_KEYUP
        send_keyboard_input(hex_code, flags)
        return
    try:
        hex_code = EXTENDED_KEYS[key_name]
    except KeyError:
        raise ValueError('invalid literal for key_release(): {}'.format(key))
    else:
        flags = (win32con.KEYEVENTF_EXTENDEDKEY | KEYEVENTF_SCANCODE |
                 win32con.KEYEVENTF_KEYUP)
        send_keyboard_input(hex_code, flags)
Simulates a key release event.

    Sends a scancode to the computer to report which key has been released.
    Some games use DirectInput devices, and respond only to scancodes, not
    virtual key codes. You can simulate DirectInput key releases using this
    method. A call to the key_release(...) method usually follows a call to
    the key_press(..) method of the same key.

    :param key: A string indicating which key to be released.
    
airtest/core/win/ctypesinput.py