code: def encode_certificate(result):
      
      cert_body = """-----BEGIN CERTIFICATE-----\n{0}\n-----END CERTIFICATE-----\n""".format(
          "\n".join(textwrap.wrap(base64.b64encode(result).decode('utf8'), 64)))
      signed_crt = open("{}/signed.crt".format(gettempdir()), "w")
      signed_crt.write(cert_body)
      signed_crt.close()
  
      return True
docs: Encode cert bytes to PEM encoded cert file.