def make_KeyPress_from_keydescr(keydescr):
    keyinfo = KeyPress()
    if len(keydescr) > 2 and keydescr[:1] == '"' and keydescr[-1:] == '"':
        keydescr = keydescr[1:-1]
        
    while 1:
        lkeyname = keydescr.lower()
        if lkeyname.startswith('control-'):
            keyinfo.control = True
            keydescr = keydescr[8:]
        elif lkeyname.startswith('ctrl-'):
            keyinfo.control = True
            keydescr = keydescr[5:]
        elif keydescr.lower().startswith('\\c-'):
            keyinfo.control = True
            keydescr = keydescr[3:]
        elif keydescr.lower().startswith('\\m-'):
            keyinfo.meta = True
            keydescr = keydescr[3:]
        elif escape_sequence_to_special_key in keydescr:
            keydescr = escape_sequence_to_special_key[keydescr]
        elif lkeyname.startswith('meta-'):
            keyinfo.meta = True
            keydescr = keydescr[5:]
        elif lkeyname.startswith('alt-'):
            keyinfo.meta = True
            keydescr = keydescr[4:]
        elif lkeyname.startswith('shift-'):
            keyinfo.shift = True
            keydescr = keydescr[6:]
        else:
            if len(keydescr) > 1:
                if keydescr.strip().lower() in validkey:
                    keyinfo.keyname = keydescr.strip().lower()
                    keyinfo.char = ""
                else:
                    raise IndexError("Not a valid key: '%s'"%keydescr)
            else:
                keyinfo.char = keydescr
            return keyinfo
dataset/ETHPy150Open Ali-Razmjoo/OWASP-ZSC/module/readline_windows/pyreadline/keysyms/common.py/make_KeyPress_from_keydescr/swapped operands of `in`