<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def format_currency(value, decimals=2):
 """ Return a number suitably formatted for display as currency, with thousands separated by commas and up to two decimal points. '1,000' '100' '999.95' '99.95' '100,000' '1,000' '1,000.41' '23.210' '1,000' '123,456,789.12' """

    number, decimal = ((u'%%.%df' % decimals) % value).split(u'.')
    parts = []
    while len(number) > 3:
        part, number = number[-3:], number[:-3]
        parts.append(part)
    parts.append(number)
    parts.reverse()
    if int(decimal) == 0:
        return u','.join(parts)
    else:
        return u','.join(parts) + u'.' + decimal