def pem(b, name):
 s1 = b2a_base64(b)[:(-1)]
 s2 = ''
 while s1:
  s2 += (s1[:64] + '\n')
  s1 = s1[64:]
 s = ((('-----BEGIN %s-----\n' % name) + s2) + ('-----END %s-----\n' % name))
 return s

def pem ( b , name ) : s1 = b2a_base64 ( b ) [ : ( - 1 ) ] s2 = '' while s1 : s2 += ( s1 [ : 64 ] + '\n' ) s1 = s1 [ 64 : ] s = ( ( ( '-----BEGIN %s-----\n' % name ) + s2 ) + ( '-----END %s-----\n' % name ) ) return s
encode a payload bytearray into a pem string .