Return the gnomekeyring position of the closest matching

def best_guess(self):
        """Return the gnomekeyring position of the closest matching
        """
        best_guess_ever = (0, 0) # (key, string)
        points = defaultdict(float)
        points[0] = 0
        if len(self.string) > 0:
            for key in self.candidate_keys:
                guess = self.searchables[key]
                if guess == self.string:
                    points[key] += 100
                    break
                # skip, entry longer then guess
                if len(self.string) > len(guess):
                    continue
                # begins with
                if guess.startswith(self.string):
                    points[key] += 1
                # contained in
                if self.string in guess:
                    points[key] += 1
                # percentage of user search string in best guess
                if points[key] > 0:
                    points[key] += float(len(self.string))/len(guess)
        for k,v in points.iteritems():
            if points[best_guess_ever[0]] < points[k]:
                best_guess_ever = (k, self.searchables[k])
        return best_guess_ever