code: def add_separators(x):
      
      try:
          s = '{0:,}'.format(x)
          # s = '{0:n}'.format(x)  # n means locale aware (read up on this)
      # see issue #526
      except ValueError:
          return x
  
      # Quick solution for the moment
      if locale() in ['id', 'fr']:
          # Replace commas with the correct thousand separator.
          s = s.replace(',', thousand_separator())
      return s
docs: Format integer with separator between thousands.
  
      :param x: A number to be formatted in a locale friendly way.
      :type x: int
  
      :returns: A locale friendly formatted string e.g. 1,000,0000.00
          representing the original x. If a ValueError exception occurs,
          x is simply returned.
      :rtype: basestring
  
      From http://
      stackoverflow.com/questions/5513615/add-thousands-separators-to-a-number
  
      Instead use this:
      http://docs.python.org/library/string.html#formatspec