def toggle_bit_in_byte(offset: int, byte: int) -> int:
    """toggle a bit in a byte, from https://wiki.python.org/moin/BitManipulation
    :param int offset: the offest in the byte to toggle
    :param int byte: the byte
    :return: the new byte
    :rtype: int
    """
    assert 0 <= offset < 8
    assert 0 <= byte < 256
    mask = 1 << offset
    return byte ^ mask