def _is_descendant(index, target):
    """
    Return true if index is a parent of target.
    """
    while target.isValid():
        if target == index:
            return True
        target = target.parent()
    return False