#NEWLINE# def _close( self , test = False ) : #NEWLINE# #INDENT# '\n        Wrapper around `_on_close`. Its duty is to perform the necessary\n        cleanup. Closing `ResponseData` object, closing UDP sockets, and\n        gracefully exiting the process with exit code of 0.\n        ' #NEWLINE# try : #NEWLINE# #INDENT# self . _on_close ( ) #NEWLINE# #UNINDENT# except Exception as e : #NEWLINE# #INDENT# logging . exception ( ( 'Exception raised when calling _on_close: %s' % e ) ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# logging . debug ( 'Closing response data object' ) #NEWLINE# if e . _response_data : #NEWLINE# #INDENT# self . _response_data . close ( ) #NEWLINE# #UNINDENT# logging . debug ( 'Closing socket' ) #NEWLINE# self . _listener . close ( ) #NEWLINE# logging . debug ( 'Dying.' ) #NEWLINE# if ( test is False ) : #NEWLINE# #INDENT# sys . exit ( 0 )