def byte2bin(number, classic_mode=True):
 text = ''
 for i in range(0, 8):
  if classic_mode:
   mask = (1 << (7 - i))
  else:
   mask = (1 << i)
  if ((number & mask) == mask):
   text += '1'
  else:
   text += '0'
 return text

def byte2bin ( number , classic_mode = True ) : text = '' for i in range ( 0 , 8 ) : if classic_mode : mask = ( 1 << ( 7 - i ) ) else : mask = ( 1 << i ) if ( ( number & mask ) == mask ) : text += '1' else : text += '0' return text
convert a byte to a binary string .