PyExpression () { // peel off any parens, because we may have smth like (lambda x: x+1)(2) PsiElement seeker = getFirstChild(); while (seeker instanceof PyParenthesizedExpression) seeker = ((PyParenthesizedExpression)seeker).getContainedExpression(); return seeker instanceof PyExpression ? (PyExpression) seeker : null; }