def likely(self, k):
        """Returns a character likely to follow the given string
        two character string, or a space if nothing is found."""
        if k not in self.lut:
            return ' '
        # if you were using this a lot, caching would a good idea.
        letters = []
        for k, v in self.lut[k].items():
            letters.append(k * v)
        letters = ''.join(letters)
        return random.choice(letters)
Returns a character likely to follow the given string
        two character string, or a space if nothing is found.
recipes/Python/326576_Language_detectiusing_character/recipe-326576.py