code: def _der_to_pem(der_key, marker):
      
      pem_key_chunks = [('-----BEGIN %s-----' % marker).encode('utf-8')]
  
      # Limit base64 output lines to 64 characters by limiting input lines to 48 characters.
      for chunk_start in range(0, len(der_key), 48):
          pem_key_chunks.append(b64encode(der_key[chunk_start:chunk_start + 48]))
  
      pem_key_chunks.append(('-----END %s-----' % marker).encode('utf-8'))
  
      return b'\n'.join(pem_key_chunks)
docs: Perform a simple DER to PEM conversion.