def determine_annuity(
    months_to_legal_maturity: int, outstanding_balance: float, interest_rate:
        float) -> float:
    """Calculate the (monthly) annuity.
    For mortgage with specified months_to_legal_maturity (>=1), outstanding
    balance, and interest rate (decimal, annual).
    """
    tau = interest_rate / 12
    kappa = (1 + tau) ** months_to_legal_maturity
    return outstanding_balance * tau * kappa / (kappa - 1)