def generate_random_string(template_dict, key='<STR_LIT:start>'):
data = template_dict.get(key)<EOL>result = random.choice(data)<EOL>for match in token_regex.findall(result):<EOL><INDENT>word = generate_random_string(template_dict, match) or match<EOL>result = result.replace('<STR_LIT>'.format(match), word)<EOL><DEDENT>return result<EOL>
Generates a random excuse from a simple template dict.

    Based off of drow's generator.js (public domain).
    Grok it here: http://donjon.bin.sh/code/random/generator.js

    Args:
        template_dict: Dict with template strings.
        key: String with the starting index for the dict. (Default: 'start')

    Returns:
        Generated string.