protected PyExpression createExpression(Project project, String name, PsiElement declaration) {
   return PyElementGenerator.getInstance(project)
       .createExpressionFromText(LanguageLevel.forElement(declaration), name);
 }
 protected PyAssignmentStatement createDeclaration(
     Project project, String assignmentText, PsiElement anchor) {
   LanguageLevel langLevel = ((PyFile) anchor.getContainingFile()).getLanguageLevel();
   return PyElementGenerator.getInstance(project)
       .createFromText(langLevel, PyAssignmentStatement.class, assignmentText);
 }