I am using Pyhton 3.10.5
Suppose I have a list
USERNAMES = ['joy23', 'michael89', 'rony224', 'samrat445']
Now if I want to check if 'michael89' is on the list without considering the case, The following code works:
'michael89'.casefold() in USERNAMES
The output will be true.
Again if I want to check if 'MICHAEL89' is on the list without considering the case, The code is:
'MICHAEL89'.casefold() in USERNAMES
The output will also be true.
'miCHAel89'.casefold() in USERNAMES
This returns true again.

So the main catch here is the USERNAMES list should only contain lowercase letters. If you save all the items of USERNAMES in lowercase letters. You can simply solve the problem using:
if 'MICHAEL89'.casefold() in USERNAMES:
......