'Convenience method to sort the titles in `index` according to `weights`.
`index` is sorted in place. Returns `index`.
`index`: A list of titles.
`weights`: A dictionary that maps weights to titles. If any titles
in index are not in weights, they are assumed to have a weight of 0.'

def sort_index_by(self, index, weights):

    weights = defaultdict((lambda : 0), weights)
    index.sort(cmp=(lambda x, y: cmp(weights[x], weights[y])))
    return index
