def t_returns(inv, pfl, prices, date):
    """ Computes the total return of a portfolio.

    Parameters:

        - `inv`     : :class:`list` investment session `db` row
        - `pfl`     : :class:`string` name of the portfolio
        - `prices`  : :class:`dict` latest investment's ticker prices
        - `date`    : :class:`string` date of the purchase

    Computes the sum of the shares when the invesment was made to the sum of the
    shares now. The absolute change and returns are calculated with the same
    formulas as in :py:func:`check.returns`

    Returns a :class:`dict` containing the total initial price, the new
    price, the absolute change, the returns and the date of the purchase.
    """
    t_old = sum(map(lambda key: inv[pfl][key]*inv['prc'][key], inv[pfl].keys()))
    t_old = round(t_old, 1)
    t_new = sum(map(lambda key: inv[pfl][key]*prices[key], inv[pfl].keys()))
    t_new = round(t_new, 1)
    abs = round(t_new - t_old, 1)
    rel = round(((t_new - t_old) / t_old) * 100, 2)
    return {'abs': abs, 'rel': rel, 'old': t_old,
        'new': t_new, 'qty': 'NA', 'date': date}