#NEWLINE# def publish_command_failure( self , duration , failure , command_name , request_id , connection_id , op_id = None ) : #NEWLINE# #INDENT# 'Publish a CommandFailedEvent to all command listeners.\n\n        :Parameters:\n          - `duration`: The command duration as a datetime.timedelta.\n          - `failure`: The server reply document or failure description\n            document.\n          - `command_name`: The command name.\n          - `request_id`: The request id for this operation.\n          - `connection_id`: The address (host, port) of the server this\n            command was sent to.\n          - `op_id`: The (optional) operation id for this operation.\n        ' #NEWLINE# if ( op_id is None ) : #NEWLINE# #INDENT# op_id = request_id #NEWLINE# #UNINDENT# event = CommandFailedEvent ( duration , failure , command_name , request_id , connection_id , op_id ) #NEWLINE# for subscriber in self . __command_listeners : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# subscriber . failed ( event ) #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# _handle_exception ( )