def METHOD_NAME(self, template):
    # We cache the lines in the template itself. Note that among requests the
    # template may be a different instance (because the template contents could be
    # changed on disk), but this may still be called multiple times during the
    # same render session, so, caching is interesting.
    lines_cache = getattr(template, '__pydevd_lines_cache__', None)
    if lines_cache is not None:
        lines, sorted_lines = lines_cache
        return lines, sorted_lines
    lines = self._collect_valid_lines_in_template_uncached(template)
    lines = frozenset(lines)
    sorted_lines = tuple(sorted(lines))
    template.__pydevd_lines_cache__ = lines, sorted_lines
    return lines, sorted_lines