def _ebAuthenticated(self, reason):
        """
        Handle cred login errors by translating them to the SMTP authenticate
        failed.  Translate all other errors into a generic SMTP error code and
        log the failure for inspection.  Stop all errors from propagating.

        @param reason: Reason for failure.
        """
        self.challenge = None
        if reason.check(cred.error.UnauthorizedLogin):
            self.sendCode(535, b'Authentication failed')
        else:
            log.err(reason, "SMTP authentication failure")
            self.sendCode(
                451,
                b'Requested action aborted: local error in processing')

        Handle cred login errors by translating them to the SMTP authenticate
        failed.  Translate all other errors into a generic SMTP error code and
        log the failure for inspection.  Stop all errors from propagating.

        @param reason: Reason for failure.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/mail/smtp.py