#NEWLINE# def retry_with_count( side_effect_func ) : #NEWLINE# #INDENT# def retry_with_count_internal( exc_tup , exc_processor_cxt ) : #NEWLINE# #INDENT# '\n        An exception processor that counts how many times it has retried\n\n        :param exc_processor_cxt: The context counting how many times\n                                  retries have been attempted.\n\n        :type exception_cxt: integer\n\n        :param side_effect_func: A function to perform side effects in\n                                 response to the exception, such as\n                                 logging.\n\n        :type side_effect_func: function\n        ' #NEWLINE# def increment_context( exc_processor_cxt ) : #NEWLINE# #INDENT# return ( ( ( exc_processor_cxt is None ) and 1 ) or ( exc_processor_cxt + 1 ) ) #NEWLINE# #UNINDENT# if ( exc_processor_cxt is None ) : #NEWLINE# #INDENT# exc_processor_cxt = increment_context ( exc_processor_cxt ) #NEWLINE# #UNINDENT# side_effect_func ( exc_tup , exc_processor_cxt ) #NEWLINE# return increment_context ( exc_processor_cxt ) #NEWLINE# #UNINDENT# return retry_with_count_internal