void (PsiElement parent, PsiElement newItem, ASTNode beforeThis, boolean isFirst, boolean isLast, boolean addWhitespace) { ASTNode node = parent.getNode(); assert node != null; ASTNode itemNode = newItem.getNode(); assert itemNode != null; Project project = parent.getProject(); PyElementGenerator gen = PyElementGenerator.getInstance(project); if (!isFirst) node.addChild(gen.createComma(), beforeThis); node.addChild(itemNode, beforeThis); if (!isLast) node.addChild(gen.createComma(), beforeThis); if (addWhitespace) node.addChild(ASTFactory.whitespace(" "), beforeThis); }