private static boolean hasHangingIndent(@NotNull PsiElement elem) {
    if (elem instanceof PyAstCallExpression) {
      final PyAstArgumentList argumentList = ((PyAstCallExpression)elem).getArgumentList();
      return argumentList != null && hasHangingIndent(argumentList);
    }
    else if (elem instanceof PyAstFunction) {
      return hasHangingIndent(((PyAstFunction)elem).getParameterList());
    }

    final PsiElement firstChild;
    if (elem instanceof PyAstFromImportStatement) {
      firstChild = ((PyAstFromImportStatement)elem).getLeftParen();
    }
    else if (elem instanceof PyAstWithStatement) {
      firstChild = PyPsiUtilsCore.getFirstChildOfType(elem, PyTokenTypes.LPAR);
    }
    else {
      firstChild = elem.getFirstChild();
    }
    if (firstChild == null) {
      return false;
    }
    final IElementType elementType = elem.getNode().getElementType();
    final ASTNode firstChildNode = firstChild.getNode();
    if (ourHangingIndentOwners.contains(elementType) && PyTokenTypes.OPEN_BRACES.contains(firstChildNode.getElementType())) {
      if (hasLineBreakAfterIgnoringComments(firstChildNode)) {
        return true;
      }
      final PsiElement firstItem = getFirstItem(elem);
      if (firstItem == null) {
        return !PyTokenTypes.CLOSE_BRACES.contains(elem.getLastChild().getNode().getElementType());
      }
      else {
        if (firstItem instanceof PyAstNamedParameter) {
          final PyAstExpression defaultValue = ((PyAstNamedParameter)firstItem).getDefaultValue();
          return defaultValue != null && hasHangingIndent(defaultValue);
        }
        else if (firstItem instanceof PyAstKeywordArgument) {
          final PyAstExpression valueExpression = ((PyAstKeywordArgument)firstItem).getValueExpression();
          return valueExpression != null && hasHangingIndent(valueExpression);
        }
        else if (firstItem instanceof PyAstKeyValueExpression) {
          final PyAstExpression value = ((PyAstKeyValueExpression)firstItem).getValue();
          return value != null && hasHangingIndent(value);
        }
        else if (firstItem instanceof PyAstWithItem) {
          PyAstExpression contextExpression = ((PyAstWithItem)firstItem).getExpression();
          return hasHangingIndent(contextExpression);
        }
        return hasHangingIndent(firstItem);
      }
    }
    else {
      return false;
    }
  }
private static boolean hasHangingIndent(@NotNull PsiElement elem)