def send_keyboard_input(hex_code, flags):
    """Simulates a key press/release event with SendInput.

    :param hex_code: Scancode of the particular key to be pressed/released in
                     hexadecimal.
    :param flags: Flags indicating various aspects of the keystroke.
    """
    inputs = Input(type=ctypes.c_ulong(win32con.INPUT_KEYBOARD),
                   ki=KeyBdInput(wScan=hex_code, dwFlags=flags))
    ctypes.windll.user32.SendInput(1, ctypes.byref(inputs),
                                   ctypes.sizeof(inputs))
Simulates a key press/release event with SendInput.

    :param hex_code: Scancode of the particular key to be pressed/released in
                     hexadecimal.
    :param flags: Flags indicating various aspects of the keystroke.
    
airtest/core/win/ctypesinput.py