def METHOD_NAME(args):
    hashes = {}
    with tarfile.open(name=args.output, mode='r') as tfile:
        hashes = calculate_hashes(tfile, args)
    with tarfile.open(name=args.output, mode='a:') as tfile:
        with tempfile.NamedTemporaryFile(mode = "w") as tempobj:
            for filename, digest in sorted(hashes.items()):
                dbg_print(args, "...{}: {}".format(filename, digest))
                tempobj.write("{}: {}\n".format(filename, digest))
            tempobj.flush()
            tfile.add(tempobj.name, 'sha1')