#NEWLINE# def flush_entities( db_conn , descs ) : #NEWLINE# #INDENT# '\n    Given a list of kinds and entity_ids,\n    return a list filled out with entities.\n    ' #NEWLINE# output = [ ] #NEWLINE# for desc in descs : #NEWLINE# #INDENT# if ( desc [ 'kind' ] == 'card' ) : #NEWLINE# #INDENT# card = Card . get_latest_accepted ( db_conn , entity_id = desc [ 'id' ] ) #NEWLINE# card = flip_card_into_kind ( card ) #NEWLINE# if card : #NEWLINE# #INDENT# output . append ( card ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( desc [ 'kind' ] == 'unit' ) : #NEWLINE# #INDENT# output . append ( Unit . get_latest_accepted ( db_conn , entity_id = desc [ 'id' ] ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( desc [ 'kind' ] == 'set' ) : #NEWLINE# #INDENT# output . append ( Set . get_latest_accepted ( db_conn , entity_id = desc [ 'id' ] ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# output . append ( None ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# return output