human
I wrote the below code

    assert (len(candidates) > 0)
    def score(w1, w2):
        w1 = w1.lower()
        w2 = w2.lower()
        def phi(w):
            rval = {}
            for i in xrange(len(w)):
                l = w[i]
                rval[l] = (rval.get(l, 0.0) + 1.0)
                if (i < (len(w) - 1)):
                    b = w[i:(i + 2)]
                    rval[b] = (rval.get(b, 0.0) + 1.0)
            return rval
        def mul(d1, d2):
            rval = 0
            for key in set(d1).union(d2):
                rval += (d1.get(key, 0) * d2.get(key, 0))
            return rval
        tot_score = (((mul(phi(w1), phi(w2)) / float((len(w1) * len(w2)))) + (0.1 * mul(phi(w1[0:1]), phi(w2[0:1])))) + (0.1 * mul(phi(w1[(-1):]), phi(w2[(-1):]))))
        return tot_score
    scored_candidates = [((- score(wrong, candidate)), candidate) for candidate in candidates]
    scored_candidates.sort()
    return scored_candidates[0][1]

What's a good function header?
assistant
#Here's a good function header.

def match(wrong, candidates):