def parse_string(string, params, autoescape=True):
    env = jinja2.Environment(autoescape=autoescape)

    env.filters.update(JINJA_FILTERS)
    try:
        parsed_string = env.parse(string)
    except Exception:
        raise Exception('Unable to parse string with Jinja: %s' % string)

    variables = meta.find_undeclared_variables(parsed_string)
    if any([var not in params for var in variables]):
        logging.info('Cannot parse %s fully using %s', string, params)

    try:
        return env.from_string(string).render(params)
    except Exception:
        logging.error(
            'jinja_utils.parse_string() failed with args: %s, %s, %s' %
            (string, params, autoescape))
        return env.from_string('[CONTENT PARSING ERROR]').render({})
Queue up notifications of new messages to moderate
dataset/ETHPy150Open oppia/oppia/jinja_utils.py/parse_string--crossover with--dataset/ETHPy150Open ofa/connect/open_connect/notifications/tasks.py/send_moderation_notifications