def uniform_series_to_present_value(dr, t):
    """
    Returns a coefficient to convert a uniform series of payments over t
    periods to a present value in the first period using a discount rate
    of dr. This is mathematically equivalent to  the inverse of the
    capital recovery factor, assuming the same rate and number of
    periods is used for both calculations. In practice, you typically
    use an interest rate for a capital recovery factor and a discount
    rate for this.
    Example usage:
    >>> print(
    ...     "Net present value of a $10 / yr annuity paid for 20 years, "
    ...     "assuming a 5 percent discount rate is ${npv:0.2f}"
    ...     .format(npv=10 * uniform_series_to_present_value(.05, 20))
    ... )
    Net present value of a $10 / yr annuity paid for 20 years, assuming a 5 percent discount rate is $124.62

    Test for calculation validity compared to CRF using 7 decimal points
    >>> round(uniform_series_to_present_value(.07,20),7) ==         round(1/capital_recovery_factor(.07,20),7)
    True
    """
    return t if dr == 0 else (1 - (1 + dr) ** -t) / dr
