def xact_amount(xact, negate, append_currency):
    """Returns a string with the formatted transaction amount"""

    v = -xact["amount"] if negate else xact["amount"]
    fmt_str = "{:.2f} {}" if append_currency else "{:.2f}"
    ccode = xact["iso_currency_code"]

    return fmt_str.format(v, ccode)