#NEWLINE# def best_biblio_row( biblio_rows , field ) : #NEWLINE# #INDENT# matching_biblio_rows = [ row for row in biblio_rows if ( row . biblio_name == field ) ] #NEWLINE# if ( not matching_biblio_rows ) : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# matching_biblio_rows . sort ( key = operator . attrgetter ( 'sort_score' ) ) #NEWLINE# best_matching_row = next ( ( row for row in matching_biblio_rows if row . is_good_choice ) , None ) #NEWLINE# if ( not best_matching_row ) : #NEWLINE# #INDENT# best_matching_row = biblio_rows [ 0 ] #NEWLINE# #UNINDENT# return best_matching_row