public static void runTemplate(@NotNull PsiFile file, @NotNull TemplateBuilder builder) {
    final VirtualFile virtualFile = file.getVirtualFile();
    if (virtualFile == null) return;
    final Editor editor = PythonUiService.getInstance().openTextEditor(file.getProject(), virtualFile);
    if (editor != null) {
      builder.run(editor, false);
    }
    else {
      builder.runNonInteractively(false);
    }
  }
public static void runTemplate(@NotNull PsiFile file, @NotNull TemplateBuilder builder)