Python library to encode & decode data as Manchester code
$ pip3 install --user --upgrade manchester-code
0-bits translate to low-high, 1-bits to high-low (G. E. Thomas convention).
from manchester_code import encode, decode, decode_bits
manchester_code = encode([0b00001111, 0b01101001])
print(''.join(f'{m:08b}' for m in manchester_code))
# 01010101101010100110100110010110
encode(b'msg')
# b'i\xa6jZij'
decode([0b01010101, 0b10101010, 0b01101001, 0b10010110])
# 0000111101101001
decode(b'ieiVjeiV')
# b'data'
list(decode_bits([False, True, True, False]))
# [False, True]
list(decode_bits([0, 1, 1, 0, 0, 1, 0, 1]))
# [False, True, False, False]