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

    """Decorator to check whether user can publish exploration.
    """
    def test_can_manage_collection_publish_status(self, collection_id, **kwargs):
        collection_rights = rights_manager.get_collection_rights(collection_id)
        if (collection_rights is None):
            raise base.UserFacingExceptions.PageNotFoundException
        if collection_rights.is_published():
            if (role_services.ACTION_UNPUBLISH_PUBLIC_COLLECTION in self.actions):
                return handler(self, collection_id, **kwargs)
            raise self.UnauthorizedUserException('You    do    not    have    credentials    to    unpublish    this    collection.')
        if collection_rights.is_private():
            if (role_services.ACTION_PUBLISH_ANY_COLLECTION in self.actions):
                return handler(self, collection_id, **kwargs)
            if (role_services.ACTION_PUBLISH_OWNED_COLLECTION in self.actions):
                if collection_rights.is_owner(self.user_id):
                    return handler(self, collection_id, **kwargs)
            raise self.UnauthorizedUserException('You    do    not    have    credentials    to    publish    this    collection.')
    test_can_manage_collection_publish_status.__wrapped__ = True
    return test_can_manage_collection_publish_status