def _hexify(data, chunksize=None):
 if (chunksize is None):
  chunksize = _hex_chunksize
 hex = data.encode('hex_codec')
 l = len(hex)
 if (l > chunksize):
  chunks = []
  i = 0
  while (i < l):
   chunks.append(hex[i:(i + chunksize)])
   i += chunksize
  hex = ' '.join(chunks)
 return hex

def _hexify ( data , chunksize = None ) : if ( chunksize is None ) : chunksize = _hex_chunksize hex = data . encode ( 'hex_codec' ) l = len ( hex ) if ( l > chunksize ) : chunks = [ ] i = 0 while ( i < l ) : chunks . append ( hex [ i : ( i + chunksize ) ] ) i += chunksize hex = ' ' . join ( chunks ) return hex
convert a binary string into its hex encoding .