def calcPv(r, freq, periods, value):
    """
    Parameters
    ----------
    r:
      discount rate;
      the expected rate of return if every coupon payment was
      invested at a fixed interest rate until the bond matures

    freq:
      frequency

    periods:
      periods to maturity

    value:
      future value / value at maturity

    Returns
    -------
    present_value
    """
    tmp = (1 + r / freq) ** periods
    return value / tmp