python convert text file to binary