#NEWLINE# def _get_bytes_to_sign( self ) : #NEWLINE# #INDENT# '\n        Creates the message used for signing SNS notifications.\n        This is used to verify the bounce message when it is received.\n        ' #NEWLINE# msg_type = self . _data . get ( 'Type' ) #NEWLINE# if ( msg_type == 'Notification' ) : #NEWLINE# #INDENT# fields_to_sign = [ 'Message' , 'MessageId' , 'Subject' , 'Timestamp' , 'TopicArn' , 'Type' ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( msg_type == 'SubscriptionConfirmation' ) or ( msg_type == 'UnsubscribeConfirmation' ) ) : #NEWLINE# #INDENT# fields_to_sign = [ 'Message' , 'MessageId' , 'SubscribeURL' , 'Timestamp' , 'Token' , 'TopicArn' , 'Type' ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# logger . warning ( 'Unrecognized SNS message Type: "%s"' , msg_type ) #NEWLINE# return None #NEWLINE# #UNINDENT# #UNINDENT# outbytes = StringIO ( ) #NEWLINE# for field_name in fields_to_sign : #NEWLINE# #INDENT# field_value = smart_str ( self . _data . get ( field_name , '' ) , errors = 'replace' ) #NEWLINE# if field_value : #NEWLINE# #INDENT# outbytes . write ( field_name ) #NEWLINE# outbytes . write ( '\n' ) #NEWLINE# outbytes . write ( field_value ) #NEWLINE# outbytes . write ( '\n' ) #NEWLINE# #UNINDENT# #UNINDENT# return outbytes . getvalue ( )