shorter use of codecs.open
reversed
type may be str or unicode