void (final Project project, final PsiFile file) { ImportOptimizer optimizer = new PyImportOptimizer(); final Runnable runnable = optimizer.processFile(file); WriteCommandAction.writeCommandAction(project, file).withName(getFamilyName()).run(() -> runnable.run()); }