'Translate the text according to the given level.
Args:
text (str): The text to translate
level (real): Value between 0.0 and 1.0, where
0.0 means no obfuscation (text returned unchanged) and
1.0 means full conversion of every word. The closer to
1, the shorter words will be translated.
language (str): The language key identifier.
Returns:
text (str): A translated string.'

def translate(self, text, level=0.0, language='default'):

    if (level == 0.0):
        return text
    language = self.db.language_storage.get(language, None)
    if (not language):
        return text
    self.language = language
    self.level = int((10 * (1.0 - max(0, min(level, 1.0)))))
    return _RE_WORD.sub(self._translate_sub, text)
