function changeStyle (cartocss, attr, newStyle) {
  if (_.isUndefined(newStyle)) return cartocss;

  var cssTree = generateCSSTreeFromCartoCSS(cartocss);
  var root = cssTree.result.root;
  var attributeAlreadyChanged = false;

  if (root) {
    root.walkDecls(attr, function (node) {
      var parentNode = node.parent;

      if (!(isOutlineRule(parentNode) && _.contains(OUTLINE_ATTRS, attr))) {
        if (isSelectorRule(parentNode) || attributeAlreadyChanged) {
          // If the attribute is inside a conditional selection, it has to be removed
          node.remove();
        } else {
          // If the attribute is inside a regular root (or symbolizer), it just
          // changes the value
          node.value = newStyle;
          attributeAlreadyChanged = true;
        }
      }
    });

    return cssTree.css;
  }

  return cartocss;
}
Change attr style and remove all the duplicates
@param  {String} cartocss cartocss original String
@param  {String} attr     CSS Attribute ex, polygon-fill
@param  {String} newStyle New style value ex, red;
@return {String}          Cartocss modified String