  from django.conf import settings
  from django.core.management.base import BaseCommand, CommandError
  from django.db import DEFAULT_DB_ALIAS, connections, migrations
  from django.db.migrations.executor import MigrationExecutor
  from django.db.migrations.loader import AmbiguityError
  from django.db.migrations.migration import SwappableTuple
  from django.db.migrations.optimizer import MigrationOptimizer
  from django.db.migrations.writer import MigrationWriter
  from django.utils import six
  from django.utils.version import get_docs_version
 
</s> remove             migration = executor.loader.get_migration_by_prefix(app_label, migration_name)
 </s> add             migration = loader.get_migration_by_prefix(app_label, migration_name) </s> remove             executor.loader.get_migration(al, mn)
            for al, mn in executor.loader.graph.forwards_plan((migration.app_label, migration.name))
 </s> add             loader.get_migration(al, mn)
            for al, mn in loader.graph.forwards_plan((migration.app_label, migration.name)) </s> remove         executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])
        if app_label not in executor.loader.migrated_apps:
 </s> add         loader = MigrationLoader(connections[DEFAULT_DB_ALIAS])
        if app_label not in loader.migrated_apps:
from django.db.migrations.loader import AmbiguityError, MigrationLoader
  from django.conf import settings
  from django.core.management.base import BaseCommand, CommandError
  from django.db import DEFAULT_DB_ALIAS, connections, migrations
from django.db.migrations.loader import AmbiguityError, MigrationLoader
from django.db.migrations.loader import AmbiguityError, MigrationLoader
  from django.db.migrations.migration import SwappableTuple
  from django.db.migrations.optimizer import MigrationOptimizer
  from django.db.migrations.writer import MigrationWriter
  from django.utils import six
  from django.utils.version import get_docs_version
keep keep keep replace replace keep keep keep keep keep
 Fixed #24703 -- Changed squashmigrations to use a MigrationLoader

Changed squashmigrations to not instantiate a MigrationExecutor,
but to directly use a MigrationLoader instance instead. 
django/core/management/commands/squashmigrations.py