def _get_active_parent(self):
    parent = self.parent
    while True:
        if ((parent is not None) and (parent._cont is not None) and (not parent._ended)):
            break
        parent = parent.parent
    return parent
def _get_active_parent(self):
    parent = self.parent
    while True:
        if ((parent is not None) and (parent._cont is not None) and (not parent._ended)):
            break
        parent = parent.parent
    return parent