def ancestorset(self, starts, stops=None):
    stops = ((stops and set(stops)) or set())
    seen = set()
    pending = list(starts)
    while pending:
        n = pending.pop()
        if ((n not in seen) and (n not in stops)):
            seen.add(n)
            pending.extend(self.parents(n))
    return seen
def ancestorset(self, starts, stops=None):
    stops = ((stops and set(stops)) or set())
    seen = set()
    pending = list(starts)
    while pending:
        n = pending.pop()
        if ((n not in seen) and (n not in stops)):
            seen.add(n)
            pending.extend(self.parents(n))
    return seen