def get_draft_subtree_roots(draft_nodes):
 urls = [draft_node.url for draft_node in draft_nodes]
 for draft_node in draft_nodes:
  if (draft_node.parent_url not in urls):
   (yield draft_node)

def get_draft_subtree_roots ( draft_nodes ) : urls = [ draft_node . url for draft_node in draft_nodes ] for draft_node in draft_nodes : if ( draft_node . parent_url not in urls ) : ( yield draft_node )
takes a list of draft_nodes .