#!/usr/bin/env python

class AccountBalanceError(Exception):
    def __init__(self, account_balance, amount):
        super().__init__(account_balance, amount)
        self.account_balance = account_balance
        self.amount = amount

    def __str__(self):
        delta = self.amount - self.account_balance
        return f"Account balance too low (need {delta} USD more)"



class Account:
    def __init__(self, amount):
        self.account_balance = amount

    def withdraw(self, amount):
        if amount > self.account_balance:
            raise AccountBalanceError(self.account_balance, amount)
        self.account_balance -= amount


if __name__ == "__main__":
    a = Account(1000)

    try:
        a.withdraw(2000)
    except AccountBalanceError as e:
        print(f"Account balance: {e.account_balance} USD")
        print(f"Unable to withdraw {e.amount} USD")

    a.withdraw(2000)
