#NEWLINE# def format_pythonrunner_result( result ) : #NEWLINE# #INDENT# output = format_possible_failure_result ( result ) #NEWLINE# result_ = result . get ( 'result' , None ) #NEWLINE# if ( result_ is not None ) : #NEWLINE# #INDENT# output [ 'result' ] = result_ #NEWLINE# #UNINDENT# stdout = result . get ( 'stdout' , None ) #NEWLINE# if stdout : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# output [ 'stdout' ] = stdout . strip ( ) #NEWLINE# #UNINDENT# except AttributeError : #NEWLINE# #INDENT# output [ 'stdout' ] = result #NEWLINE# #UNINDENT# #UNINDENT# stderr = result . get ( 'stderr' , None ) #NEWLINE# if stderr : #NEWLINE# #INDENT# output [ 'stderr' ] = stderr . strip ( ) #NEWLINE# #UNINDENT# exit_code = result . get ( 'exit_code' , 0 ) #NEWLINE# if ( exit_code != 0 ) : #NEWLINE# #INDENT# output [ 'exit_code' ] = exit_code #NEWLINE# #UNINDENT# return _serialize ( output )