def requires_authentication(func):
        """
        Function decorator that throws an exception if the user
        is not authenticated, and executes the function normally
        if the user is authenticated.
        """
        def _auth(self, *args, **kwargs):
            if not self._authenticated:
                raise NotAuthenticatedException('Function {} requires'
                                                .format(func.__name__)
                                                + ' authentication')
            else:
                return func(self, *args, **kwargs)
        return _auth
Function decorator that throws an exception if the user
        is not authenticated, and executes the function normally
        if the user is authenticated.