#NEWLINE# def safe_repr( obj , short = False ) : #NEWLINE# #INDENT# "\n    Function from python 2.7's unittest.util. Used in methods that is copied \n    from 2.7's unittest.TestCase to work in python 2.6.\n    " #NEWLINE# _MAX_LENGTH = 80 #NEWLINE# try : #NEWLINE# #INDENT# result = repr ( obj ) #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# result = object . __repr__ ( obj ) #NEWLINE# #UNINDENT# if ( ( not short ) or ( len ( _MAX_LENGTH ) < _MAX_LENGTH ) ) : #NEWLINE# #INDENT# return result #NEWLINE# #UNINDENT# return ( result [ : _MAX_LENGTH ] + ' [truncated]...' )