<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def traverse_ancestors(self, include_self=True):
        '''Traverse over the ancestors of this ``Node``

        Args:
            ``include_self`` (``bool``): ``True`` to include self in the traversal, otherwise ``False``
        '''
        if not isinstance(include_self, bool):
            raise TypeError("include_self must be a bool")
        if include_self:
            c = self
        else:
            c = self.parent
        while c is not None:
            yield c; c = c.parent