public static void runInlineTemplate(@NotNull Project project,
                                       PsiElement element,
                                       TemplateBuilderImpl builder, int offset) {
    final VirtualFile virtualFile = element.getContainingFile().getVirtualFile();
    if (virtualFile == null) {
      return;
    }
    Editor editor = PythonUiService.getInstance().openTextEditor(project, virtualFile, offset);
    if (editor != null) {
      Template template = builder.buildInlineTemplate();
      TemplateManager.getInstance(project).startTemplate(editor, template);
    } else {
      builder.runNonInteractively(true);
    }
  }
public static void runInlineTemplate(@NotNull Project project,
                                       PsiElement element,
                                       TemplateBuilderImpl builder, int offset)