How to iterate over each bit of a byte in Python