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

    """Decorator to check whether the user can edit given exploration.
    """
    def test_can_edit(self, exploration_id, **kwargs):
        if (not self.user_id):
            raise base.UserFacingExceptions.NotLoggedInException
        exploration_rights = rights_manager.get_exploration_rights(exploration_id)
        if (exploration_rights is None):
            raise base.UserFacingExceptions.PageNotFoundException
        if rights_manager.check_can_edit_activity(self.user_id, self.actions, constants.ACTIVITY_TYPE_EXPLORATION, exploration_rights):
            return handler(self, exploration_id, **kwargs)
        else:
            raise base.UserFacingExceptions.UnauthorizedUserException('You    do    not    have    credentials    to    edit    this    exploration.')
    test_can_edit.__wrapped__ = True
    return test_can_edit