def open_with_encoding(filename, encoding=None, mode=u'r'):
 if (not encoding):
  encoding = detect_encoding(filename)
 return io.open(filename, mode=mode, encoding=encoding, newline=u'')

def open_with_encoding ( filename , encoding = None , mode = u'r' ) : if ( not encoding ) : encoding = detect_encoding ( filename ) return io . open ( filename , mode = mode , encoding = encoding , newline = u'' )
return opened file with a specific encoding .