'HTMLSanitizerMixin.sanitize_css replacement.
HTMLSanitizerMixin.sanitize_css always whitelists background-*,
border-*, margin-*, and padding-*. We only whitelist what\'s in
the whitelist.'

def sanitize_css(self, style):

    style = re.compile(u'url\\s*\\(\\s*[^\\s)]+?\\s*\\)\\s*').sub(u'    ', style)
    parts = style.split(u';')
    gauntlet = re.compile(u'^([-/:,#%.\'"\\sa-zA-Z0-9!]|\\w-\\w|\'[\\s\\w]+\'\\s*|"[\\s\\w]+"|\\([\\d,%\\.\\s]+\\))*$')
    for part in parts:
        if (not gauntlet.match(part)):
            return u''
    if (not re.match(u'^\\s*([-\\w]+\\s*:[^:;]*(;\\s*|$))*$', style)):
        return u''
    clean = []
    for (prop, value) in re.findall(u'([-\\w]+)\\s*:\\s*([^:;]*)', style):
        if (not value):
            continue
        if (prop.lower() in self.allowed_css_properties):
            clean.append((((prop + u':    ') + value) + u';'))
        elif (prop.lower() in self.allowed_svg_properties):
            clean.append((((prop + u':    ') + value) + u';'))
    return u'    '.join(clean)
