use python csv library to replace my function