PyExpression (@NotNull PyStatement def, @NotNull String localName, @NotNull Project project) { final PyExpression value = getValue(def); assert value != null; if (def instanceof PyAugAssignmentStatement expression) { final PsiElement operation = expression.getOperation(); assert operation != null; final String op = operation.getText().replace('=', ' '); final LanguageLevel level = LanguageLevel.forElement(value); return PyElementGenerator.getInstance(project).createExpressionFromText(level, localName + " " + op + value.getText() + ")"); } return value; }