#NEWLINE# def _read_file( filename , ext ) : #NEWLINE# #INDENT# ext = ext . replace ( '.' , '' ) . lower ( ) #NEWLINE# if ( ext not in [ 'csv' , 'yaml' , 'mat' , 'vtp' , 'dat' ] ) : #NEWLINE# #INDENT# raise Exception ( ( ext + ' is not a supported file extension' ) ) #NEWLINE# #UNINDENT# if ( not filename . endswith ( ( '.' + ext ) ) ) : #NEWLINE# #INDENT# filename = ( ( filename + '.' ) + ext ) #NEWLINE# #UNINDENT# f = open ( filename , mode = 'r' ) #NEWLINE# return f