( turn_on )
return is_on
toggle_numlock(int) ->  int

    Turns NUMLOCK on or off and returns whether
    it was originally on or off.
toggle_numlock(int) ->  int
toggle_numlock ( int ) - > int
def toggle_numlock( turn_on ) :
    '''
    toggle_numlock(int) ->  int

    Turns NUMLOCK on or off and returns whether
    it was originally on or off. 
    '''

    is_on = 0
    keys = [];

    is_on = windll.user32.GetKeyState( VK_NUMLOCK ) & 1

    if is_on != turn_on :	
        windll.user32.keybd_event(VK_NUMLOCK, 
                    69, 
                    KEYEVENTF_EXTENDEDKEY | 0, 
                    0);
        windll.user32.keybd_event(VK_NUMLOCK, 
                    69, 
                    KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 
                    0);

	

    return is_on
def toggle_numlock ( turn_on ) : is_on = 0 keys = [ ] is_on = windll . user32 . GetKeyState ( VK_NUMLOCK ) & 1 if is_on != turn_on : windll . user32 . keybd_event ( VK_NUMLOCK , 69 , KEYEVENTF_EXTENDEDKEY | 0 , 0 ) windll . user32 . keybd_event ( VK_NUMLOCK , 69 , KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP , 0 ) return is_on