def authenticate_account(self, identifiers, authc_token, second_factor_token=None):
msg = ("<STR_LIT>"<EOL>"<STR_LIT>" + str(authc_token) + "<STR_LIT:]>")<EOL>logger.debug(msg)<EOL>if not getattr(authc_token, '<STR_LIT>', None):<EOL><INDENT>if not identifiers:<EOL><INDENT>msg = "<STR_LIT>"<EOL>raise InvalidAuthenticationSequenceException(msg)<EOL><DEDENT>authc_token.identifier = identifiers.primary_identifier<EOL><DEDENT>authc_token.token_info = token_info[authc_token.__class__]<EOL>try:<EOL><INDENT>account = self.do_authenticate_account(authc_token)<EOL>if (account is None):<EOL><INDENT>msg2 = ("<STR_LIT>"<EOL>"<STR_LIT>".<EOL>format(authc_token))<EOL>raise AccountException(msg2)<EOL><DEDENT><DEDENT>except AdditionalAuthenticationRequired as exc:<EOL><INDENT>if second_factor_token:<EOL><INDENT>return self.authenticate_account(exc.account_id, second_factor_token, None)<EOL><DEDENT>self.notify_event(authc_token.identifier, '<STR_LIT>')<EOL>raise exc  <EOL><DEDENT>except AccountException:<EOL><INDENT>self.notify_event(authc_token.identifier,<EOL>'<STR_LIT>')<EOL>raise<EOL><DEDENT>except LockedAccountException:<EOL><INDENT>self.notify_event(authc_token.identifier, '<STR_LIT>')<EOL>self.notify_event(authc_token.identifier, '<STR_LIT>')<EOL>raise<EOL><DEDENT>except IncorrectCredentialsException as exc:<EOL><INDENT>self.notify_event(authc_token.identifier, '<STR_LIT>')<EOL>self.validate_locked(authc_token, exc.failed_attempts)<EOL>raise IncorrectCredentialsException<EOL><DEDENT>self.notify_event(account['<STR_LIT>'].primary_identifier,<EOL>'<STR_LIT>')<EOL>return account['<STR_LIT>']<EOL>
:type identifiers: SimpleIdentifierCollection or None

:returns: account_id (identifiers) if the account authenticates
:rtype: SimpleIdentifierCollection