def get_parent(self, context):
parent = self.parent_name.resolve(context)<EOL>if hasattr(parent, "<STR_LIT>"):<EOL><INDENT>return parent<EOL><DEDENT>template = self.find_template(parent, context)<EOL>for node in template.nodelist:<EOL><INDENT>if (isinstance(node, ExtendsNode) and<EOL>node.parent_name.resolve(context) == parent):<EOL><INDENT>return self.find_template(parent, context, peeking=True)<EOL><DEDENT><DEDENT>return template<EOL>
Load the parent template using our own ``find_template``, which
will cause its absolute path to not be used again. Then peek at
the first node, and if its parent arg is the same as the
current parent arg, we know circular inheritance is going to
occur, in which case we try and find the template again, with
the absolute directory removed from the search list.