def has_cloned_parent(c, p):
    """Return True if p has a cloned parent within the @rst tree."""
    root = c.rstCommands.root
    p = p.parent()
    while p and p != root:
        if p.isCloned():
            return True
        p.moveToParent()
    return False