def intcomma(value):
    orig = str(value)
    new = re.sub("^(-?\d+)(\d{3})", '\g<1>,\g<2>', orig)
    if orig == new:
        return new
    else:
        return intcomma(new)
Borrowed from django.contrib.humanize
dataset/ETHPy150Open eyeseast/python-tablefu/table_fu/formatting.py/intcomma