<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def parse_template(app, filename):
 """Parses the given template using the jinja environment of the given app and returns the AST. ASTs are cached in parse_template.cache """

    if not hasattr(parse_template, "cache"):
        parse_template.cache = {}
    if filename not in parse_template.cache:
        source = get_template_source(app, filename)
        parse_template.cache[filename] = app.jinja_env.parse(source, filename=filename)
    return parse_template.cache[filename]