#NEWLINE# def deliver( self , message ) : #NEWLINE# #INDENT# result = None #NEWLINE# while True : #NEWLINE# #INDENT# with self . transport ( ) as transport : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# result = transport . deliver ( message ) #NEWLINE# #UNINDENT# except MessageFailedException as e : #NEWLINE# #INDENT# raise DeliveryFailedException ( message , ( e . args [ 0 ] if e . args else 'No reason given.' ) ) #NEWLINE# #UNINDENT# except TransportFailedException : #NEWLINE# #INDENT# transport . ephemeral = True #NEWLINE# continue #NEWLINE# #UNINDENT# except TransportExhaustedException : #NEWLINE# #INDENT# transport . ephemeral = True #NEWLINE# #UNINDENT# #UNINDENT# break #NEWLINE# #UNINDENT# return ( message , transport )