def Parents(it):
  """ Return a generator to the parents of all the nodes in the passed
  iterable. Note that we first use a set to remove duplicates among the
  parents."""
  return iter(set((n.GetParent() for n in it if n.GetParent() != None)))