def valid_xml_char_ordinal(c):
    """Filters out certain bytes so that XML files contains valid
    characters. XML standard defines a valid character as:
    Char ::= #x9 | #xA | #xD | [#x20 - #xD7FF] |
            [#xE000 - #xFFFD] | [#x10000 - #x10FFFF]

    Args:
        c: Character to be checked

    Returns:
        true if character codepoint in valid range
    """
    codepoint = ord(c)
    #conditions ordered by presumed frequency
    return (
        0x20 <= codepoint <= 0xD7FF or
        codepoint in (0x9, 0xA, 0xD) or
        0xE000 <= codepoint <= 0xFFFD or
        0x10000 <= codepoint <= 0x10FFFF
    )