<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_deleted_objects(self, request, queryset):
 """ Find all objects related to instances of ``queryset`` that should also be deleted. Returns - to_delete - a nested list of strings suitable for display in the template with the ``unordered_list`` filter. - model_count - statistics for models of all deleted instances - perms_needed - list of names for all instances which can not be deleted because of not enough rights - protected - list of names for all objects protected for deletion because of reference type """

        collector = NestedObjects(using=queryset.db)
        collector.collect(queryset)
        model_perms_needed = set()
        object_perms_needed = set()

        STRONG_DELETION_CONTROL = getattr(settings, 'ACCESS_STRONG_DELETION_CONTROL', False)

        def format_callback(obj):
            has_admin = obj.__class__ in self.admin_site._registry
            opts = obj._meta

            no_edit_link = '%s: %s' % (capfirst(opts.verbose_name),
                                   force_text(obj))

            # Trying to get admin change URL
            admin_url = None
            try:
                admin_url = reverse('%s:%s_%s_change'
                                % (self.admin_site.name,
                                   opts.app_label,
                                   opts.model_name),
                                None, (quote(obj._get_pk_val()),))
            except NoReverseMatch:
                # Change url doesn't exist -- don't display link to edit
                pass

            # Collecting forbidden subobjects, compatible with Django or forced by the option
            if STRONG_DELETION_CONTROL or has_admin:
                if not obj.__class__._meta.auto_created:
                    manager = AccessManager(obj.__class__)
                    # filter out forbidden items
                    if manager.check_deleteable(obj.__class__, request) is False:
                        model_perms_needed.add(opts.verbose_name)
                    if not manager.apply_deleteable(obj.__class__._default_manager.filter(pk=obj.pk), request):
                        object_perms_needed.add(obj)

            if admin_url:
                # Display a link to the admin page.
                return format_html('{}: <a href="{}">{}</a>',
                               capfirst(opts.verbose_name),
                               admin_url,
                               obj)
            else:
                # Don't display link to edit, because it either has no
                # admin or is edited inline.
                return no_edit_link

        to_delete = collector.nested(format_callback)

        protected = [format_callback(obj) for obj in collector.protected]
        protected = set([format_callback(obj) for obj in object_perms_needed]).union(protected)
        model_count = {model._meta.verbose_name_plural: len(objs) for model, objs in collector.model_objs.items()}

        return to_delete, model_count, model_perms_needed, protected