What I do is have an exclusion routine which halts the experiment to exclude participants.
e.g.
if expInfo['age'] == 1:
text_exclusion.text = 'Thank you for your interest in this study.\n\nHowever, I am only studying adults.\n\nPlease press the escape key or close your browser tab to quit.'
elif expInfo['english'] != '4': # The default text_exclusion.text is about excluding native English speakers.
continueRoutine = False
or
if exclusion == 0:
continueRoutine = False
elif expInfo['depression'] == '2':
continueRoutine = False