def pp_num(num):
    """
    pretty prints number with commas
    """
    s = '%d' % num
    groups = []
    while s and s[-1].isdigit():
        groups.append(s[-3:])
        s = s[:-3]
    return s + ','.join(reversed(groups))