@Nullable
  private static PsiElement getFirstItem(@NotNull PsiElement elem) {
    PsiElement[] items = PsiElement.EMPTY_ARRAY;
    if (elem instanceof PyAstSequenceExpression) {
      items = ((PyAstSequenceExpression)elem).getElements();
    }
    else if (elem instanceof PyAstParameterList) {
      items = ((PyAstParameterList)elem).getParameters();
    }
    else if (elem instanceof PyAstArgumentList) {
      items = ((PyAstArgumentList)elem).getArguments();
    }
    else if (elem instanceof PyAstFromImportStatement) {
      items = ((PyAstFromImportStatement)elem).getImportElements();
    }
    else if (elem instanceof PyAstWithStatement) {
      items = ((PyAstWithStatement)elem).getWithItems();
    }
    else if (elem instanceof PyAstParenthesizedExpression) {
      final PyAstExpression containedExpression = ((PyAstParenthesizedExpression)elem).getContainedExpression();
      if (containedExpression instanceof PyAstTupleExpression) {
        items = ((PyAstTupleExpression)containedExpression).getElements();
      }
      else if (containedExpression != null) {
        return containedExpression;
      }
    }
    else if (elem instanceof PyAstComprehensionElement) {
      return ((PyAstComprehensionElement)elem).getResultExpression();
    }
    return ArrayUtil.getFirstElement(items);
  }
@Nullable
  private static PsiElement getFirstItem(@NotNull PsiElement elem)