void (@NotNull Project project, @NotNull ProblemDescriptor descriptor) { final PsiElement element = descriptor.getPsiElement(); final PyElementGenerator elementGenerator = PyElementGenerator.getInstance(project); final PyNamedParameter parameter = elementGenerator.createParameter(element.getText() + "=None"); final PyFunction function = PsiTreeUtil.getParentOfType(element, PyFunction.class); if (function != null) { final PyParameterList parameterList = function.getParameterList(); parameterList.addParameter(parameter); CodeInsightUtilCore.forcePsiPostprocessAndRestoreElement(parameterList); final TemplateBuilder builder = TemplateBuilderFactory.getInstance().createTemplateBuilder(parameter); builder.replaceRange(TextRange.create(parameter.getTextLength() - 4, parameter.getTextLength()), "None"); PythonTemplateRunner.runTemplate(function.getContainingFile(), builder); } }