<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def render_template_to_string(input, _from_string=False, **context):
 """Render a template from the template folder with the given context. Code based on `<https://github.com/mitsuhiko/flask/blob/master/flask/templating.py>`_ :param input: the string template, or name of the template to be rendered, or an iterable with template names the first one existing will be rendered :param context: the variables that should be available in the context of the template. :return: a string """

    if _from_string:
        template = current_app.jinja_env.from_string(input)
    else:
        template = current_app.jinja_env.get_or_select_template(input)
    return template.render(context)