working version of read_file() in python