<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def update_nodes_published(self):
 """ publish or unpublish nodes of current layer """

        if self.pk:
            self.node_set.all().update(is_published=self.is_published)