If statements and changing feedback

Hi everyone,
I am new to PsychoPY and I am trying to improve my understanding of coding in particular how to do if statements correctly.
Currently, the final “if statement” (lines 3-8) tells the participant the response was correct if they press the correct key, but otherwise the feedback is ambiguous (incorrect / too long). I want to add in new conditional statements (elif) to tell the participant when they made an incorrect response.
And change the feedback so that it only tells the participant they took too long if 5 seconds have passed.
Any help with adding this code in will be greatly apprecaited!

Below is the code

win.flip() 
    key = event.waitKeys(maxWait=5,keyList=['b','r']) # waits for either an r or b key to be pressed. If 5 seconds pass, then it moves on without a response 
     
    if key == ['b'] and stimOn == 'blue': # if the key pressed was b and the stimulus presented was blue         feedback.text = "Correct!" 
    elif key == ['r'] and stimOn == 'red': # if the key pressed was r and the stimulus presented was red         feedback.text = "Correct!" 
    else: 
        feedback.text = "Incorrect / too long!"     feedback.draw()     win.flip()     core.wait(2)     win.flip() 
    core.wait(0.2)

Can you edit the code above to show everything on the right line? (I edited your post to add triple ``` before and after the code so that we can now see the correctly-formatted indenting.)