#NEWLINE# def insured( pool , fun , args , kwargs , errback = None , on_revive = None , **opts ) : #NEWLINE# #INDENT# 'Ensures function performing broker commands completes\n    despite intermittent connection failures.' #NEWLINE# errback = ( errback or _ensure_errback ) #NEWLINE# with pool . acquire ( block = True ) as conn : #NEWLINE# #INDENT# conn . ensure_connection ( errback = errback ) #NEWLINE# channel = conn . default_channel #NEWLINE# revive = partial ( revive_connection , conn , on_revive = on_revive ) #NEWLINE# insured = conn . autoretry ( fun , channel , errback = errback , on_revive = pool , ** opts ) #NEWLINE# ( retval , _ ) = insured ( * args , ** dict ( kwargs , connection = conn ) ) #NEWLINE# return retval