#NEWLINE# def _process_json( event , pager_command ) : #NEWLINE# #INDENT# 'Conditionally highlights the supplied JSON value.\n\n    :param event: event to emit to stdout\n    :type event: str, dict, list, or dcos.errors.Error\n    :returns: String representation of the supplied JSON value,\n              possibly syntax-highlighted.\n    :rtype: str\n    ' #NEWLINE# json_output = json . dumps ( event , sort_keys = True , indent = 2 ) #NEWLINE# json_output = re . sub ( '\\s+$' , '' , json_output , 0 , re . M ) #NEWLINE# force_colors = False #NEWLINE# if ( not sys . stdout . isatty ( ) ) : #NEWLINE# #INDENT# if force_colors : #NEWLINE# #INDENT# return _highlight_json ( json_output ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return json_output #NEWLINE# #UNINDENT# #UNINDENT# supports_colors = ( not util . is_windows_platform ( ) ) #NEWLINE# pager_is_set = ( pager_command is not None ) #NEWLINE# should_highlight = ( force_colors or ( supports_colors and ( not pager_is_set ) ) ) #NEWLINE# if should_highlight : #NEWLINE# #INDENT# json_output = _highlight_json ( json_output ) #NEWLINE# #UNINDENT# return json_output