#NEWLINE# def _entity_criterion( self , entity ) : #NEWLINE# #INDENT# if hasattr ( entity , 'parententity' ) : #NEWLINE# #INDENT# entity = entity . parententity #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# cls = _class_to_mapper ( entity ) . class_ #NEWLINE# #UNINDENT# except AttributeError : #NEWLINE# #INDENT# raise #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# alias = ( entity if isinstance ( entity , AliasedClass ) else cls ) #NEWLINE# prop = self . property_name #NEWLINE# if ( prop in dir ( cls ) ) : #NEWLINE# #INDENT# crit = getattr ( alias , prop ) #NEWLINE# if ( crit is not None ) : #NEWLINE# #INDENT# if ( not isinstance ( crit , ClauseElement ) ) : #NEWLINE# #INDENT# crit = cast ( crit , Boolean ) #NEWLINE# #UNINDENT# return crit #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return None