<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def publish(self, request, qs):
 """ Publish bulk action """

        # Convert polymorphic queryset instances to real ones if/when necessary
        try:
            qs = self.model.objects.get_real_instances(qs)
        except AttributeError:
            pass
        for q in qs:
            if self.has_publish_permission(request, q):
                q.publish()