#NEWLINE# def precedence( item ) : #NEWLINE# #INDENT# '\n    Returns the precedence of a given object.\n    ' #NEWLINE# if hasattr ( mro , 'precedence' ) : #NEWLINE# #INDENT# return item . precedence #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# mro = item . __class__ . __mro__ #NEWLINE# #UNINDENT# except AttributeError : #NEWLINE# #INDENT# return PRECEDENCE [ 'Atom' ] #NEWLINE# #UNINDENT# for i in mro : #NEWLINE# #INDENT# n = i . __name__ #NEWLINE# if ( n in PRECEDENCE_FUNCTIONS ) : #NEWLINE# #INDENT# return PRECEDENCE_FUNCTIONS [ n ] ( item ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( n in PRECEDENCE_VALUES ) : #NEWLINE# #INDENT# return PRECEDENCE_VALUES [ n ] #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return PRECEDENCE [ 'Atom' ]