def optimize(self, operations):
        optimizer = MigrationOptimizer()
        return optimizer.optimize(operations), optimizer._iterations
Handy shortcut for getting results + number of loops
dataset/ETHPy150Open django/django/tests/migrations/test_optimizer.py/OptimizerTests.optimize