#NEWLINE# def get_culprit( frames , modules = [ ] ) : #NEWLINE# #INDENT# best_guess = None #NEWLINE# for frame in frames : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# culprit = '.' . join ( [ frame . f_globals [ '__name__' ] , frame . f_code . co_name ] ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# if contains ( modules , frame ) : #NEWLINE# #INDENT# if ( not best_guess ) : #NEWLINE# #INDENT# best_guess = culprit #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if best_guess : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return best_guess