human
Complete this python program:
def can_send_moderator_emails(handler):
assistant
#Here is the Python program you requested.

    """Decorator to check whether user can send moderator emails.
    """
    def test_can_send_moderator_emails(self, **kwargs):
        if (not self.user_id):
            raise base.UserFacingExceptions.NotLoggedInException
        if (role_services.ACTION_SEND_MODERATOR_EMAILS in self.actions):
            return handler(self, **kwargs)
        raise self.UnauthorizedUserException('You    do    not    have    credentials    to    send    moderator    emails.')
    test_can_send_moderator_emails.__wrapped__ = True
    return test_can_send_moderator_emails