def format_money(amount, digits=None, widen=0, locale=None):
 if (not locale):
  loc = get_current_babel_locale()
 else:
  loc = get_babel_locale(locale)
 if ((widen == 0) and (digits is None)):
  return format_currency(amount.value, amount.currency, locale=loc, currency_digits=True)
 pattern = loc.currency_formats['standard'].pattern
 if (digits is not None):
  pattern = pattern.replace('.00', ('.' + (digits * '0')))
 if widen:
  pattern = pattern.replace('.00', ('.00' + (widen * '0')))
 return format_currency(amount.value, amount.currency, pattern, loc, currency_digits=False)

def format_money ( amount , digits = None , widen = 0 , locale = None ) : if ( not locale ) : loc = get_current_babel_locale ( ) else : loc = get_babel_locale ( locale ) if ( ( widen == 0 ) and ( digits is None ) ) : return format_currency ( amount . value , amount . currency , locale = loc , currency_digits = True ) pattern = loc . currency_formats [ 'standard' ] . pattern if ( digits is not None ) : pattern = pattern . replace ( '.00' , ( '.' + ( digits * '0' ) ) ) if widen : pattern = pattern . replace ( '.00' , ( '.00' + ( widen * '0' ) ) ) return format_currency ( amount . value , amount . currency , pattern , loc , currency_digits = False )
format a money object in the given locale .