#NEWLINE# def open_compat( path , mode = 'r' ) : #NEWLINE# #INDENT# if ( ( mode in [ 'r' , 'rb' ] ) and ( not os . path . exists ( path ) ) ) : #NEWLINE# #INDENT# raise FileNotFoundError ( ( 'The file "%s" could not be found' % errors ) ) #NEWLINE# #UNINDENT# if ( sys . version_info >= ( 3 , ) ) : #NEWLINE# #INDENT# encoding = 'utf-8' #NEWLINE# errors = 'replace' #NEWLINE# if ( mode in [ 'rb' , 'wb' , 'ab' ] ) : #NEWLINE# #INDENT# encoding = None #NEWLINE# errors = None #NEWLINE# #UNINDENT# return open ( path , mode , encoding = encoding , errors = errors ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return open ( path , mode )