def doAuthenticate(self, msg):
        if not self.authenticate_decoder:
            self.authenticate_decoder = ircutils.AuthenticateDecoder()
        self.authenticate_decoder.feed(msg)
        if not self.authenticate_decoder.ready:
            return # Waiting for other messages
        string = self.authenticate_decoder.get()
        self.authenticate_decoder = None

        mechanism = self.sasl_current_mechanism
        if mechanism == 'ecdsa-nist256p-challenge':
            if string == b'':
                self.sendSaslString(self.sasl_username.encode('utf-8'))
                return
            try:
                with open(self.sasl_ecdsa_key) as fd:
                    private_key = SigningKey.from_pem(fd.read())
                authstring = private_key.sign(base64.b64decode(msg.args[0].encode()))
                self.sendSaslString(authstring)
            except (BadDigestError, __HOLE__, ValueError):
                self.sendMsg(ircmsgs.IrcMsg(command='AUTHENTICATE',
                    args=('*',)))
                self.tryNextSaslMechanism()
        elif mechanism == 'external':
            self.sendSaslString(b'')
        elif mechanism == 'plain':
            authstring = b'\0'.join([
                self.sasl_username.encode('utf-8'),
                self.sasl_username.encode('utf-8'),
                self.sasl_password.encode('utf-8'),
            ])
            self.sendSaslString(authstring)
dataset/ETHPy150Open ProgVal/Limnoria/src/irclib.py/Irc.doAuthenticate