#NEWLINE# def exitFilter( exit_fprint , cons_rel_stats , descriptors , fast , stable , internal , port ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# rel_stat = cons_rel_stats [ exit_fprint ] #NEWLINE# desc = descriptors [ rel_stat . digest ] #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# if ( desc . ntor_onion_key is None ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# if ( Flag . BADEXIT in rel_stat . flags ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# if ( Flag . RUNNING not in rel_stat . flags ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# if ( Flag . VALID not in rel_stat . flags ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# if ( ( fast is True ) and ( Flag . FAST not in rel_stat . flags ) ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# if ( ( stable is True ) and ( Flag . STABLE not in rel_stat . flags ) ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# if ( internal is True ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( port is not None ) : #NEWLINE# #INDENT# return desc . exit_policy . can_exit_to ( port = port ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return desc . exit_policy . is_exiting_allowed