private static void parenthesise(@NotNull PsiElement wrappable, @NotNull Document doc) {
    TextRange rangeToParenthesise;
    if (wrappable instanceof PyAstFromImportStatement fromImportStatement) {
      rangeToParenthesise = getRangeForPsiElementArray(fromImportStatement.getImportElements());
    }
    else if (wrappable instanceof PyAstWithStatement withStatement) {
      rangeToParenthesise = getRangeForPsiElementArray(withStatement.getWithItems());
    }
    else {
      rangeToParenthesise = wrappable.getTextRange();
    }
    if (rangeToParenthesise != null) {
      doc.insertString(rangeToParenthesise.getEndOffset(), ")");
      doc.insertString(rangeToParenthesise.getStartOffset(), "(");
    }
  }
private static void parenthesise(@NotNull PsiElement wrappable, @NotNull Document doc)