def decode_vt_100(iterable, default_set='<STR_LIT>', alt_set='<STR_LIT>', escape='<STR_LIT>'):
for is_escape, group in groupby(iterable, lambda _: _ == escape):<EOL><INDENT>if is_escape:<EOL><INDENT>continue<EOL><DEDENT>characters = '<STR_LIT>'.join(group)<EOL>if characters.startswith(default_set):<EOL><INDENT>yield characters[len(default_set) :]<EOL><DEDENT>elif characters.startswith(alt_set):<EOL><INDENT>for character in characters[len(alt_set) :]:<EOL><INDENT>yield VT_100_MAPPING[hex(ord(character))]<EOL><DEDENT><DEDENT><DEDENT>
Decodes a sequence of VT100 characters.

    Notes:
        https://stackoverflow.com/a/48046132/3727678