def path(self, include_root=False):
path = '<STR_LIT>' % (self.tagname, self.index or <NUM_LIT:0>)<EOL>p = self.parent<EOL>while p is not None:<EOL><INDENT>if p.parent or include_root:<EOL><INDENT>path = '<STR_LIT>' % (p.tagname, p.index or <NUM_LIT:0>, path)<EOL><DEDENT>p = p.parent<EOL><DEDENT>return path<EOL>
Returns a canonical path to this element, relative to the root node.

:param include_root: If ``True``, include the root node in the path. Defaults to ``False``.