_illegal_unichrs = [(0, 8), (11, 12), (14, 31), (127, 132), (134, 159), (
    64976, 64991), (65534, 65535)]
if sys.maxunicode >= 65536:
    pass
Fast way to filter illegal xml unicode chars in python?