Python Write Binary String Problem