<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def authenticate(self, transport, account_name, password):
 """ Authenticates account, if no password given tries to pre-authenticate. @param transport: transport to use for method calls @param account_name: account name @param password: account password @return: AuthToken if authentication succeeded @raise AuthException: if authentication fails """

        if not isinstance(transport, ZimbraClientTransport):
            raise ZimbraClientException('Invalid transport')

        if util.empty(account_name):
            raise AuthException('Empty account name')