def valid_xml_char_ordinal(c):
    codepoint = ord(c)
return 32 <= codepoint <= 55295 or codepoint in (9, 10, 13
    ) or 57344 <= codepoint <= 65533 or 65536 <= codepoint <= 1114111
Фильтрация определенных байтов в python