def _extract_jinja_frames(exc_tb) -> str:
    """
    Extract all the frames in the traceback that look like jinja frames

    Returns:
        A multiline string with a formatted traceback of all the Jinja
        synthetic frames or an empty string if none were found.
    """
    lines = []
    while exc_tb:
        code = exc_tb.tb_frame.f_code
        if code.co_name in (
            "template",
            "top-level template code",
        ) or code.co_name.startswith("block "):
            lines.append(f"  at {code.co_filename}:{exc_tb.tb_lineno}")
        exc_tb = exc_tb.tb_next
    return "\n".join(lines)