public static boolean isNeedParenthesis(@NotNull final PyElement oldExpr, @NotNull final PyElement newExpr) {
    final PyElement parentExpr = (PyElement)oldExpr.getParent();
    if (parentExpr instanceof PyArgumentList) {
      return newExpr instanceof PyTupleExpression;
    }
    if (parentExpr instanceof PyParenthesizedExpression || !(parentExpr instanceof PyExpression)) {
      return false;
    }
    final int newPriority = getExpressionPriority(newExpr);
    final int parentPriority = getExpressionPriority(parentExpr);
    if (parentPriority > newPriority) {
      return true;
    }
    else if (parentPriority == newPriority && parentPriority != 0 && parentExpr instanceof PyBinaryExpression binaryExpression) {
      if (isNotAssociative(binaryExpression) && oldExpr == getLeastPrioritySide(binaryExpression)) {
        return true;
      }
    }
    else if (newExpr instanceof PyConditionalExpression && parentExpr instanceof PyConditionalExpression) {
      return true;
    }
    return false;
  }
public static boolean isNeedParenthesis(@NotNull final PyElement oldExpr, @NotNull final PyElement newExpr)