def calc_chksums(buf):
 unsigned_chksum = (256 + sum((struct.unpack('148B', buf[:148]) + struct.unpack('356B', buf[156:512]))))
 signed_chksum = (256 + sum((struct.unpack('148b', buf[:148]) + struct.unpack('356b', buf[156:512]))))
 return (unsigned_chksum, signed_chksum)

def calc_chksums ( buf ) : unsigned_chksum = ( 256 + sum ( ( struct . unpack ( '148B' , buf [ : 148 ] ) + struct . unpack ( '356B' , buf [ 156 : 512 ] ) ) ) ) signed_chksum = ( 256 + sum ( ( struct . unpack ( '148b' , buf [ : 148 ] ) + struct . unpack ( '356b' , buf [ 156 : 512 ] ) ) ) ) return ( unsigned_chksum , signed_chksum )
calculate the checksum for a members header by summing up all characters except for the chksum field which is treated as if it was filled with spaces .