def selector_replace(selector, original, replacement)
      selector = parse_selector(selector, :selector)
      original = parse_selector(original, :original)
      replacement = parse_selector(replacement, :replacement)

      extends = Sass::Util::SubsetMap.new
      begin
        replacement.populate_extends(extends, original, nil, [], true)
        selector.do_extend(extends, [], true).to_sass_script
      rescue Sass::SyntaxError => e
        raise ArgumentError.new(e.to_s)
      end
    end
def selector_replace(selector, original, replacement)
      selector = parse_selector(selector, :selector)
      original = parse_selector(original, :original)
      replacement = parse_selector(replacement, :replacement)

      extends = Sass::Util::SubsetMap.new
      begin
        replacement.populate_extends(extends, original, nil, [], true)
        selector.do_extend(extends, [], true).to_sass_script
      rescue Sass::SyntaxError => e
        raise ArgumentError.new(e.to_s)
      end
    end
Replaces all instances of `$original` with `$replacement` in `$selector`

 This works by using `@extend` and throwing away the original
 selector. This means that it can be used to do very advanced
 replacements; see the examples below.

 @example
   selector-replace(".foo .bar", ".bar", ".baz") => ".foo .baz"
   selector-replace(".foo.bar.baz", ".foo.baz", ".qux") => ".bar.qux"

 @overload selector_replace($selector, $original, $replacement)
   @param $selector [Sass::Script::Value::String, Sass::Script::Value::List]
     The selector within which `$original` is replaced with
     `$replacement`. This can be either a string, a list of
     strings, or a list of lists of strings as returned by `&`.
   @param $original [Sass::Script::Value::String, Sass::Script::Value::List]
     The selector being replaced. This can be either a string, a
     list of strings, or a list of lists of strings as returned
     by `&`.
   @param $replacement [Sass::Script::Value::String, Sass::Script::Value::List]
     The selector that `$original` is being replaced with. This
     can be either a string, a list of strings, or a list of
     lists of strings as returned by `&`.
   @return [Sass::Script::Value::List]
     A list of lists of strings representing the result of the
     extension. This is in the same format as a selector returned
     by `&`.
   @raise [ArgumentError] if the replacement fails