@Override
            public void handleInsert(@NotNull InsertionContext context) {
              super.handleInsert(context);
              Document document = context.getDocument();
              CharSequence docChars = document.getCharsSequence();
              int tailOffset = context.getTailOffset();
              if (!(tailOffset < document.getTextLength() && docChars.charAt(tailOffset) == '}')) {
                document.insertString(tailOffset, "}");
              }
              // It can happen when completion is invoked on multiple carets inside the same string
              String stringElemPrefix = PyStringLiteralCoreUtil.getPrefix(docChars, stringElemStart);
              if (!PyStringLiteralUtil.isFormattedPrefix(stringElemPrefix)) {
                document.insertString(stringElemStart, "f");
              }
            }
@Override
            public void handleInsert(@NotNull InsertionContext context)