write bit in python