def METHOD_NAME(self, template_name):
    # Cache the lists of dependencies for each template name.
    if self.dependency_cache.get(template_name) is None:
        # Use a breadth-first search to find all templates this one
        # depends on.
        queue = deque([template_name])
        visited_templates = set([template_name])
        deps = []
        while len(queue) > 0:
            curr = queue.popleft()
            source, filename = self.lookup.loader.get_source(self.lookup,
                                                             curr)[:2]
            deps.append(filename)
            ast = self.lookup.parse(source)
            dep_names = meta.find_referenced_templates(ast)
            for dep_name in dep_names:
                if (dep_name not in visited_templates and dep_name is not None):
                    visited_templates.add(dep_name)
                    queue.append(dep_name)
        self.dependency_cache[template_name] = deps
    return self.dependency_cache[template_name]