def METHOD_NAME(apps, schema_editor):
    def on_migrations_complete(sender=None, **kwargs):
        try:
            apps = kwargs["apps"]
        except KeyError:
            # In test when we use use `@pytest.mark.django_db(transaction=True)`
            # pytest trigger additional post_migrate signal without `apps` in kwargs.
            return
        Group = apps.get_model("account", "Group")
        Permission = apps.get_model("permission", "Permission")
        ContentType = apps.get_model("contenttypes", "ContentType")
        ct, _ = ContentType.objects.get_or_create(app_label="page", model="pagetype")
        manage_page_types_and_attributes_perm, _ = Permission.objects.get_or_create(
            codename="manage_page_types_and_attributes",
            content_type=ct,
            name="Manage page types and attributes.",
        )
        groups = Group.objects.filter(
            permissions__content_type__app_label="page",
            permissions__codename="manage_pages",
        )
        for group in groups:
            group.permissions.add(manage_page_types_and_attributes_perm)
    sender = registry.get_app_config("page")
    post_migrate.connect(on_migrations_complete, weak=False, sender=sender)