'Parse the contents of a <style> tag or .css file.
@param style: C{str(style)} should be the CSS to parse.
@return: A dictionary with one entry per selector where the key is the
selector name and the value is a dictionary of properties'

def parse_css(self, style):

    (sdict, pdict) = ({}, {})
    style = re.sub('/\\*.*?\\*/', '', style)
    for sel in re.findall(HTMLConverter.SELECTOR_PAT, style):
        for key in sel[0].split(','):
            val = self.parse_style_properties(sel[1])
            key = key.strip().lower()
            if ('+' in key):
                continue
            if (':' in key):
                (key, sep, pseudo) = key.partition(':')
                if (key in pdict):
                    if (pseudo in pdict[key]):
                        pdict[key][pseudo].update(val)
                    else:
                        pdict[key][pseudo] = val
                else:
                    pdict[key] = {pseudo: val}
            elif (key in sdict):
                sdict[key].update(val)
            else:
                sdict[key] = val
    return (sdict, pdict)
