refactor. autodetect call ZipFile.write or ZipFile.writestr