def save_pem(contents, pem_marker):
 (pem_start, pem_end) = _markers(pem_marker)
 b64 = base64.encodestring(contents).replace(b('\n'), b(''))
 pem_lines = [pem_start]
 for block_start in range(0, len(b64), 64):
  block = b64[block_start:(block_start + 64)]
  pem_lines.append(block)
 pem_lines.append(pem_end)
 pem_lines.append(b(''))
 return b('\n').join(pem_lines)

def save_pem ( contents , pem_marker ) : ( pem_start , pem_end ) = _markers ( pem_marker ) b64 = base64 . encodestring ( contents ) . replace ( b ( '\n' ) , b ( '' ) ) pem_lines = [ pem_start ] for block_start in range ( 0 , len ( b64 ) , 64 ) : block = b64 [ block_start : ( block_start + 64 ) ] pem_lines . append ( block ) pem_lines . append ( pem_end ) pem_lines . append ( b ( '' ) ) return b ( '\n' ) . join ( pem_lines )
saves a pem file .