Log out of a user.

        Parameters
        ----------
        auth_secret: str
            The authentication secret of the logged-in user.

        Returns
        -------
        bool
            True if the logout is successful, False otherwise.
        result
            None if the logout is successful, a dict containing the error string
            with the key ERROR_KEY otherwise.

        Note
        ----
        Possible error strings are listed as below:

        -  ERROR_NOT_LOGGED_IN

def logout(self, auth_secret):
        """Log out of a user.

        Parameters
        ----------
        auth_secret: str
            The authentication secret of the logged-in user.

        Returns
        -------
        bool
            True if the logout is successful, False otherwise.
        result
            None if the logout is successful, a dict containing the error string
            with the key ERROR_KEY otherwise.

        Note
        ----
        Possible error strings are listed as below:

        -  ERROR_NOT_LOGGED_IN
        """
        result = {pytwis_constants.ERROR_KEY: None}

        # Check if the user is logged in.
        loggedin, userid = self._is_loggedin(auth_secret)
        if not loggedin:
            result[pytwis_constants.ERROR_KEY] = pytwis_constants.ERROR_NOT_LOGGED_IN
            return (False, result)

        # Generate the new authentication secret.
        new_auth_secret = secrets.token_hex()

        # Replace the old authentication secret by the new one.
        userid_profile_key = pytwis_constants.USER_PROFILE_KEY_FORMAT.format(userid)
        with self._rc.pipeline() as pipe:
            pipe.multi()
            pipe.hset(userid_profile_key, pytwis_constants.AUTH_KEY, new_auth_secret)
            pipe.hset(pytwis_constants.AUTHS_KEY, new_auth_secret, userid)
            pipe.hdel(pytwis_constants.AUTHS_KEY, auth_secret)
            pipe.execute()

        result[pytwis_constants.USERNAME_KEY] = \
            self._rc.hget(userid_profile_key, pytwis_constants.USERNAME_KEY)
        result[pytwis_constants.AUTH_KEY] = ''
        return (True, result)