function addLinkedStyleSheet(url, deferred) {
        var attributes = {
            type: "text/css",
            rel:  "stylesheet",
            href: url
        };

        var $link = $("<link/>").attr(attributes);

        if (deferred) {
            $link.on('load', deferred.resolve).on('error', deferred.reject);
        }

        $link.appendTo("head");

        return $link[0];
    }
Appends a <link> tag to the document's head.

@param {!string} url URL to a style sheet
@param {$.Deferred=} deferred Optionally check for load and error events
@return {!HTMLLinkElement} The generated HTML node