#NEWLINE# def extract_ids( node_instances , key = 'id' ) : #NEWLINE# #INDENT# if node_instances : #NEWLINE# #INDENT# return [ ( instance [ key ] if isinstance ( instance , dict ) else getattr ( instance , key ) ) for instance in node_instances ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return [ ]