PsiElement (@NotNull PsiElement elem) { PsiElement[] items = PsiElement.EMPTY_ARRAY; if (elem instanceof PySequenceExpression) { items = ((PySequenceExpression)elem).getElements(); } else if (elem instanceof PyParameterList) { items = ((PyParameterList)elem).getParameters(); } else if (elem instanceof PyArgumentList) { items = ((PyArgumentList)elem).getArguments(); } else if (elem instanceof PyFromImportStatement) { items = ((PyFromImportStatement)elem).getImportElements(); } else if (elem instanceof PyWithStatement) { items = ((PyWithStatement)elem).getWithItems(); } else if (elem instanceof PyParenthesizedExpression) { final PyExpression containedExpression = ((PyParenthesizedExpression)elem).getContainedExpression(); if (containedExpression instanceof PyTupleExpression) { items = ((PyTupleExpression)containedExpression).getElements(); } else if (containedExpression != null) { return containedExpression; } } else if (elem instanceof PyComprehensionElement) { return ((PyComprehensionElement)elem).getResultExpression(); } return ArrayUtil.getFirstElement(items); }