use codecs to open file
add parameters to specify the first and last month of a year to finalize