def tree_hash(fo):
    hashes = []
    hashes.extend(fo)
    while len(hashes) > 1:
        new_hashes = []
        while True:
            if len(hashes) > 1:
                first = hashes.pop(0)
                second = hashes.pop(0)
                new_hashes.append(hashlib.sha256(first + second).digest())
            elif len(hashes) == 1:
                only = hashes.pop(0)
                new_hashes.append(only)
            else:
                break
        hashes.extend(new_hashes)
    return hashes[0]
Given a hash of each 1MB chunk (from chunk_hashes) this will hash
dataset/ETHPy150Open uskudnik/amazon-glacier-cmd-interface/glacier/glaciercorecalls.py/tree_hash