<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=None, ostr=None, **kwargs):
 """Generate report from a campaign :param template: Jinja template to use, ``DEFAULT_TEMPLATE`` is used if not specified :param ostr: output file or filename. Default is standard output """

    jinja_environment.filters['texscape'] = tex_escape
    template = template or DEFAULT_TEMPLATE
    ostr = ostr or sys.stdout
    jinja_template = jinja_environment.get_template(template)
    jinja_template.stream(**kwargs).dump(ostr)