def calc_chksums(buf):
unsigned_chksum = <NUM_LIT> + sum(struct.unpack("<STR_LIT>", buf[:<NUM_LIT>]) + struct.unpack("<STR_LIT>", buf[<NUM_LIT>:<NUM_LIT>]))<EOL>signed_chksum = <NUM_LIT> + sum(struct.unpack("<STR_LIT>", buf[:<NUM_LIT>]) + struct.unpack("<STR_LIT>", buf[<NUM_LIT>:<NUM_LIT>]))<EOL>return unsigned_chksum, signed_chksum<EOL>
Calculate the checksum for a member's header by summing up all
       characters except for the chksum field which is treated as if
       it was filled with spaces. According to the GNU tar sources,
       some tars (Sun and NeXT) calculate chksum with signed char,
       which will be different if there are chars in the buffer with
       the high bit set. So we calculate two checksums, unsigned and
       signed.