def return_polynomial_factory(net_principal, returns, return_days):
    """Factory for a callable with point evaluation of the return polynomial.

    The return polynomial for a loan with net principal :math:`s_\circ`,
    returns :math:`r_1,r_2,\ldots,r_k` to be paid :math:`n_1,n_2,\ldots,n_k`
    days after the loan is granted, respectively, is given by

    .. math::

        f(c) = s_\\circ (1 + c)^{n_k} - r_1 (1 + c)^{n_k-n_1} - \\cdots
        - r_{k-1} (1 + c)^{n_k-n_{k-1}} - r_k.

    This function builds and returns a callable implementing such polynomial.

    Parameters
    ----------
    net_principal : float, required
        The net principal of a grossed up loan.
    returns : list of floats, required
        Due payments that completely pay off the grossed up principal when
        respectively applied for the given return days.
    return_days : list of ints, required
        List with the number of days since the taxable event (which is usually
        a "loan granted" event) happened.

    Returns
    -------
    Callable
        Python callable implementing the return polynomial for the given
        parameters
    """

    coefficients_vec = [net_principal] + [-1 * r for r in returns]

    def return_polynomial(irr_):

        powers_vec = [
            (1 + irr_) ** (return_days[-1] - n) for n in [0] + return_days
        ]

        return sum(
            coef * power
            for coef, power in zip(coefficients_vec, powers_vec)
        )

    return return_polynomial