use locale.format for thousands separators since it is compatible with python 2.6.