def _pad_binary(bin_str, req_len=8):
 bin_str = bin_str[2:]
 return ((max(0, (req_len - len(bin_str))) * '0') + bin_str)

def _pad_binary ( bin_str , req_len = 8 ) : bin_str = bin_str [ 2 : ] return ( ( max ( 0 , ( req_len - len ( bin_str ) ) ) * '0' ) + bin_str )
given a binary string (returned by bin()) .