@NotNull
    private static List<LookupElement> addCompletionsForSubstitutions(@NotNull final CompletionParameters parameters,
                                                                      @NotNull final PsiElement original,
                                                                      @NotNull final PyStringLiteralExpression stringExpression) {
      final int stringOffset = getCaretStartOffsetInsideString(parameters, stringExpression);

      if (isInsideFormatSubstitutionChunk(stringExpression, stringOffset)) {
        final PyExpression[] arguments = getFormatFunctionKeyWordArguments(original);
        final ArrayList<LookupElement> elements = new ArrayList<>();
        for (PyExpression argument : arguments) {
          if (argument instanceof PyKeywordArgument) {
            elements.add(getKeywordArgument((PyKeywordArgument)argument));
          }
          else if (argument instanceof PyStarArgument) {
            elements.addAll(getKeysFromStarArgument((PyStarArgument)argument));
          }
        }
        return elements;
      }

      if (isInsidePercentSubstitutionChunk(stringExpression, stringOffset)) {
        final PyBinaryExpression binExpr = PyUtil.as(PsiTreeUtil.getParentOfType(stringExpression, PyBinaryExpression.class),
                                                     PyBinaryExpression.class);
        if (binExpr != null) {
          final PyExpression rightExpr = PyPsiUtils.flattenParens(binExpr.getRightExpression());

          final PyDictLiteralExpression dict = PyUtil.as(rightExpr, PyDictLiteralExpression.class);
          if (dict != null) {
            return getElementsFromDict(dict);
          }

          final PyCallExpression callExpression = PyUtil.as(rightExpr, PyCallExpression.class);
          if (callExpression != null) {
            final PyExpression callee = callExpression.getCallee();
            if (callee != null && callee.getName() != null && callee.getName().equals(DICT_NAME)) {
              final PyExpression[] arguments = callExpression.getArguments();
              return Arrays.stream(arguments)
                .filter(a -> a instanceof PyKeywordArgument)
                .map(a -> getKeywordArgument((PyKeywordArgument)a))
                .filter(e -> e != null)
                .collect(Collectors.toList());
            }
          }
        }
      }
      return Collections.emptyList();
    }
@NotNull
    private static List<LookupElement> addCompletionsForSubstitutions(@NotNull final CompletionParameters parameters,
                                                                      @NotNull final PsiElement original,
                                                                      @NotNull final PyStringLiteralExpression stringExpression)