'Sort signatures in ascending level of genericity.
Returns a 2-tuple:
* ordered list of signatures
* dictionary containing genericity scores'

def _sort_signatures(self, candidates):

    genericity = defaultdict(int)
    for (this, other) in permutations(candidates.keys(), r=2):
        matched = self._match_arglist(formal_args=this, actual_args=other)
        if matched:
            genericity[this] += 1
    ordered = sorted(candidates.keys(), key=(lambda x: genericity[x]))
    return (ordered, genericity)
