def login(self, username, password): if username not in self.users or self.users[username] != password: raise smtplib.SMTPAuthenticationError self.username = username self.password = password