import hashlib


def make_epoch_seed(epoch_tx_count, ledger_count, sorted_ledger, address_from_ledger):
    """
    epoch_tx_count = number of transactions made in a given epoch
    ledger_count = the total number of ledger entries in the ledger database.
    sorted_ledger = iterable that returns the nth ledger item. Must be sorted by
                    amount and then address.
    address_from_ledger = callable that returns the address from the ledger entry
                          returned by sorted_ledger
    """
    index = epoch_tx_count % ledger_count
    return hashlib.sha256(
        str(epoch_tx_count) + address_from_ledger(sorted_ledger[index])
    ).hexdigest()