def _base64ify(data, chunksize=None):
 if (chunksize is None):
  chunksize = _base64_chunksize
 b64 = data.encode('base64_codec')
 b64 = b64.replace('\n', '')
 l = len(b64)
 if (l > chunksize):
  chunks = []
  i = 0
  while (i < l):
   chunks.append(b64[i:(i + chunksize)])
   i += chunksize
  b64 = ' '.join(chunks)
 return b64

def _base64ify ( data , chunksize = None ) : if ( chunksize is None ) : chunksize = _base64_chunksize b64 = data . encode ( 'base64_codec' ) b64 = b64 . replace ( '\n' , '' ) l = len ( b64 ) if ( l > chunksize ) : chunks = [ ] i = 0 while ( i < l ) : chunks . append ( b64 [ i : ( i + chunksize ) ] ) i += chunksize b64 = ' ' . join ( chunks ) return b64
convert a binary string into its base64 encoding .