def parse_hotkey(hotkey):
if _is_number(hotkey) or len(hotkey) == <NUM_LIT:1>:<EOL><INDENT>scan_codes = key_to_scan_codes(hotkey)<EOL>step = (scan_codes,)<EOL>steps = (step,)<EOL>return steps<EOL><DEDENT>elif _is_list(hotkey):<EOL><INDENT>if not any(map(_is_list, hotkey)):<EOL><INDENT>step = tuple(key_to_scan_codes(k) for k in hotkey)<EOL>steps = (step,)<EOL>return steps<EOL><DEDENT>return hotkey<EOL><DEDENT>steps = []<EOL>for step in _re.split(r'<STR_LIT>', hotkey):<EOL><INDENT>keys = _re.split(r'<STR_LIT>', step)<EOL>steps.append(tuple(key_to_scan_codes(key) for key in keys))<EOL><DEDENT>return tuple(steps)<EOL>
Parses a user-provided hotkey into nested tuples representing the
parsed structure, with the bottom values being lists of scan codes.
Also accepts raw scan codes, which are then wrapped in the required
number of nestings.

Example:

    parse_hotkey("alt+shift+a, alt+b, c")
    #    Keys:    ^~^ ^~~~^ ^  ^~^ ^  ^
    #    Steps:   ^~~~~~~~~~^  ^~~~^  ^

    # ((alt_codes, shift_codes, a_codes), (alt_codes, b_codes), (c_codes,))