def _sign(self, certificate_request, password):
        if self.service.portal is None:
            raise BadCertificateRequest("This agent cannot sign certificates.")

        subj = certificate_request.getSubject()

        sk = subj.keys()
        if 'commonName' not in sk:
            raise BadCertificateRequest(
                "Certificate requested with bad subject: %s" % (sk,))

        uandd = subj.commonName.split("@")
        if len(uandd) != 2:
            raise BadCertificateRequest("Won't sign certificates for other domains")
        domain = uandd[1]

        CS = self.service.certificateStorage
        ourCert = CS.getPrivateCertificate(domain)

        D = self.service.portal.login(
            UsernamePassword(subj.commonName,
                             password),
            self,
            ivertex.IQ2QUser)

        def _(ial):
            (iface, aspect, logout) = ial
            ser = CS.genSerial(domain)
            return dict(certificate=aspect.signCertificateRequest(
                    certificate_request, ourCert, ser))

        return D.addCallback(_)
Instantiate a well-behaved Options class.
dataset/ETHPy150Open twisted/vertex/vertex/q2q.py/Q2Q._sign--crossover with--dataset/ETHPy150Open kuri65536/python-for-android/python-modules/twisted/twisted/test/test_usage.py/HelpStringTest.setUp