private static void makeFStringFragmentsReplacements(@NotNull Map<PyFStringFragment, PyStringElement> fStringFragmentsReplacements) {
    var fString2Replacements = new MultiMap<PyFormattedStringElement, Pair<PyFStringFragment, String>>();

    for (var entry : fStringFragmentsReplacements.entrySet()) {
      PyFStringFragment fStringFragment = entry.getKey();
      PyFormattedStringElement fString = (PyFormattedStringElement)fStringFragment.getParent();
      String valueProperQuotes = entry.getValue().getContent();
      fString2Replacements.putValue(fString, Pair.create(fStringFragment, valueProperQuotes));
    }

    var fStrings = new ArrayList<>(fString2Replacements.keySet());
    fStrings.sort(Comparator.comparingInt(it -> -it.getTextOffset()));

    for (var fString : fStrings) {
      var replacements = fString2Replacements.get(fString);
      PyElementGenerator elementGenerator = PyElementGenerator.getInstance(fString.getProject());

      var replacementsSegments =
        ContainerUtil.sorted(ContainerUtil.map(replacements, it -> Pair.create(it.first.getTextRangeInParent(), it.second)),
                             Comparator.comparingInt(it -> -it.first.getStartOffset()));

      StringBuilder elementStringBuilder = new StringBuilder(fString.getText());
      for (var segment : replacementsSegments) {
        elementStringBuilder.replace(segment.first.getStartOffset(), segment.first.getEndOffset(), segment.second);
      }

      String resultString = elementStringBuilder.toString();

      PyStringElement elementToReplace = (PyStringElement)elementGenerator.createStringLiteralAlreadyEscaped(resultString).getFirstChild();
      fString.replace(elementToReplace);
    }
  }
private static void makeFStringFragmentsReplacements(@NotNull Map<PyFStringFragment, PyStringElement> fStringFragmentsReplacements)