<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_templates_generator(*files, **template_map):
 """Render jinja templates according to template_map. Yields (path, result) """

    for path in files:
        if not os.path.isfile(path):
            raise ValueError("Template file %s not found"
                             % os.path.relpath(path))
        else:
            try:
                with codecs.open(path, encoding='utf-8') as f:
                    text = f.read()
                template = JINJA_ENV.from_string(text)
            except jinja2.TemplateSyntaxError as err:
                msg = ("Error rendering jinja2 template for file %s "
                       "on line %s. Error: %s"
                       % (path, err.lineno, err.message))
                raise type(err)(
                    msg, err.lineno, filename=os.path.basename(path))

            result = template.render(**template_map)
            if not result.endswith('\n'):
                result += '\n'
            yield path, result