<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def create_can_publish_and_can_republish_permissions(sender, **kwargs):
 """ Add `can_publish` and `ca_nrepublish` permissions for each publishable model in the system. """

    for model in sender.get_models():
        if not issubclass(model, PublishingModel):
            continue
        content_type = ContentType.objects.get_for_model(model)
        permission, created = Permission.objects.get_or_create(
            content_type=content_type, codename='can_publish',
            defaults=dict(name='Can Publish %s' % model.__name__))
        permission, created = Permission.objects.get_or_create(
            content_type=content_type, codename='can_republish',
            defaults=dict(name='Can Republish %s' % model.__name__))