'Returns a match score between the list of font families in
*families* and the font family name *family2*.
An exact match at the head of the list returns 0.0.
A match further down the list will return between 0 and 1.
No match will return 1.0.'

def score_family(self, families, family2):

    if (not isinstance(families, (list, tuple))):
        families = [families]
    elif (len(families) == 0):
        return 1.0
    family2 = family2.lower()
    step = (1 / len(families))
    for (i, family1) in enumerate(families):
        family1 = family1.lower()
        if (family1 in font_family_aliases):
            if (family1 in (u'sans', u'sans    serif')):
                family1 = u'sans-serif'
            options = rcParams[(u'font.' + family1)]
            options = [x.lower() for x in options]
            if (family2 in options):
                idx = options.index(family2)
                return ((i + (idx / len(options))) * step)
        elif (family1 == family2):
            return (i * step)
    return 1.0
