Caps lock key button

I am trying to get a response from either the caps button or return button. For some reason, the caps button is not working. only the return. Any help would be amazing as i am very stuck.

    while timer.getTime() < 1.5: 
    
        current_time = timer.getTime()
        key = kb.getKeys()
         
        if 'capslock' in key:
            draw_yes_screen = True
            draw_no_screen = False
            allow_work = True
            break

        elif 'return' in key:
            draw_no_screen = True
            draw_yes_screen = False
            allow_work = False
            break