Decorator for HAPI methods that requires the instance to be authenticated with a password

def requires_password_auth(fn):
    """Decorator for HAPI methods that requires the instance to be authenticated with a password"""
    def wrapper(self, *args, **kwargs):
        self.auth_context = HAPI.auth_context_password
        return fn(self, *args, **kwargs)
    return wrapper