def setCss(css):
    """
    Function generating a script to set a given CSS style sheet.
    
    @param css style sheet
    @type str
    @return script to set the style sheet
    @rtype str
    """
    source = """
(function() {{
    var css = document.createElement('style');
    css.setAttribute('type', 'text/css');
    css.appendChild(document.createTextNode('{0}'));
    document.getElementsByTagName('head')[0].appendChild(css);
    }})()"""
    style = css.replace("'", "\\'").replace('\n', '\\n')
    return source.format(style)
