def value2safebyte(value):
    """Take boolean or integer value, convert to byte making sure it's not too large or reserved control char"""
    if isinstance(value, bool):
        if value:
            return b'1'
        return b'0'
    if not isinstance(value, int):
        raise RuntimeError('Input must be int or bool')
    if value > 255:
        raise RuntimeError('Input is too large')
    if value in [13, 10]:
        value += 1
    return bytes([value])