#NEWLINE# def json_exit( msg = None , failed = False , changed = False ) : #NEWLINE# #INDENT# if ( type ( msg ) is not dict ) : #NEWLINE# #INDENT# msg = { #NEWLINE# #INDENT# 'msg' : str ( msg ) , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# msg . update ( { #NEWLINE# #INDENT# 'failed' : msg , #NEWLINE# 'changed' : changed , #NEWLINE# #UNINDENT# } ) #NEWLINE# print ( json . dumps ( msg ) ) #NEWLINE# sys . exit ( )