def compute_ledger_values(lazy_original_balance, report_type, quantity):
    if report_type == stockconst.REPORT_TYPE_BALANCE:
        new_balance = quantity
        # this is currently always 0 because of inferred transactions
        new_delta = 0
    elif report_type == stockconst.REPORT_TYPE_TRANSFER:
        original_balance = lazy_original_balance()
        new_delta = quantity
        new_balance = new_delta + (original_balance if original_balance else 0)
    else:
        raise ValueError()
    return LedgerValues(new_balance, new_delta)
lazy_original_balance:
dataset/ETHPy150Open dimagi/commcare-hq/corehq/apps/commtrack/processing.py/compute_ledger_values