def _parse_style_str(s):
    """
    Take an SVG 'style' attribute string like 'stroke:none;fill:black'
    and parse it into a dictionary like {'stroke' : 'none', 'fill' : 'black'}.
    """
    styledict = {}
    if s:
        # parses L -> R so later keys overwrite earlier ones
        for keyval in s.split(';'):
            l = keyval.strip().split(':')
            if l and len(l) == 2: styledict[l[0].strip()] = l[1].strip()
    return styledict
Take an SVG 'style' attribute string like 'stroke:none;fill:black'
    and parse it into a dictionary like {'stroke' : 'none', 'fill' : 'black'}.