protected Pair<String, Boolean> exec(final ConsoleCodeFragment command) throws PythonUnhandledException {
    setExecuting(true);

    // add code fragment to myConsoleView.getHistoryPsiFile()
    PsiFile psi = getHistoryPsiFile();
    if (myConsoleView != null && psi != null) {
      ApplicationManager.getApplication().invokeLater(
        () -> WriteCommandAction.runWriteCommandAction(myProject, null, null,
                                                       () -> {
                                                         PsiElement[] newElems =
                                                           PyElementGenerator.getInstance(myProject)
                                                             .createDummyFile(LanguageLevel.forElement(myConsoleView.getFile()),
                                                                              command.getText())
                                                             .getChildren();
                                                         for (PsiElement elem : newElems) {
                                                           psi.add(elem);
                                                         }
                                                       },
                                                       psi));
    }

    boolean more;
    try {
      if (command.isSingleLine()) {
        more = getPythonConsoleBackendClient().execLine(command.getText());
      }
      else {
        more = getPythonConsoleBackendClient().execMultipleLines(command.getText());
      }
    }
    catch (PythonUnhandledException e) {
      setExecuting(false);
      throw e;
    }
    catch (TException e) {
      setExecuting(false);
      throw new RuntimeException(e);
    }

    if (more) {
      setExecuting(false);
    }

    return Pair.create(null, more);
  }
protected Pair<String, Boolean> exec(final ConsoleCodeFragment command)