python sys stdout writelines