def install_trusted_ca(self):
        import ssl
        import subprocess

        # parse the url
        res = urlparse(self.url)
        if res.scheme.lower() != "https":
            return
        
        port = res.port or 443
        
        # get the PEM-encoded certificate
        cert = ssl.get_server_certificate((res.hostname, port))
        
        # the returned cert maybe messed up because of python-ssl bug Issue8086
        if not cert.endswith("\n-----END CERTIFICATE-----\n"):
            cert = cert.replace("-----END CERTIFICATE-----",
                                "\n-----END CERTIFICATE-----\n")
        
        # dump it in the directory, and run make
        with open(os.path.join(settings.XMLRPC_TRUSTED_CA_PATH,
                               res.hostname+"-ca.crt"),
                 'w') as cert_file:
            cert_file.write(cert)
        
        # TODO: Don't run make here. Do the linking manually.
        subprocess.Popen(['make', '-C', settings.XMLRPC_TRUSTED_CA_PATH],
                         stdin=subprocess.PIPE,
                         stdout=subprocess.PIPE,
                         stderr=subprocess.PIPE,
                         )
Use the Enthought trait's validate.
dataset/ETHPy150Open fp7-ofelia/ocf/expedient/src/python/expedient/common/xmlrpc_serverproxy/models.py/PasswordXMLRPCServerProxy.install_trusted_ca--crossover with--dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.main/src/openmdao/main/datatypes/str.py/Str.validate