#NEWLINE# def maybe_forward_to_zephyr( message ) : #NEWLINE# #INDENT# if ( message [ 'sender_email' ] == zulip_account_email ) : #NEWLINE# #INDENT# if ( not ( ( message [ 'type' ] == 'stream' ) or ( ( message [ 'type' ] == 'private' ) and ( False not in [ u [ 'email' ] . lower ( ) . endswith ( 'mit.edu' ) for u in message [ 'display_recipient' ] ] ) ) ) ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# timestamp_now = datetime . datetime . now ( ) . strftime ( '%s' ) #NEWLINE# if ( float ( message [ 'timestamp' ] ) < ( float ( timestamp_now ) - 15 ) ) : #NEWLINE# #INDENT# logger . warning ( ( 'Skipping out of order message: %s < %s' % ( u [ 'timestamp' ] , timestamp_now ) ) ) #NEWLINE# return #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# forward_to_zephyr ( message ) #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# logger . exception ( 'Error forwarding message:' )