結果 : how to make a function thread safe in python