public static PsiElement doIntroduceVariable(PsiElement expression,
                                               PsiElement declaration,
                                               List<? extends PsiElement> occurrences,
                                               boolean replaceAll) {
    PsiElement anchor = replaceAll ? IntroduceHandler.findAnchor(occurrences) : PsiTreeUtil.getParentOfType(expression, PyStatement.class);
    assert anchor != null;
    final PsiElement parent = anchor.getParent();
    return parent.addBefore(declaration, anchor);
  }
public static PsiElement doIntroduceVariable(PsiElement expression,
                                               PsiElement declaration,
                                               List<? extends PsiElement> occurrences,
                                               boolean replaceAll)