I will just add two small refinements. For one, 'tailPosition' is not specified in this code, but it should always be -7 since '10=xyz|' is always 7 characters.
Second, while each FIX field is terminated with the ascii SOH char (which is unprintable), it is commonly written and frequently worked with using a pipe, so I added a test to be sure pipes are counted as if they were the SOH char (ascii 1).
# Strip off checksum at end of msg: "10=xyz|"
tailPosition = -7
msgForCheckSum = raw_message[:tailPosition]
sum = 0
for c in msgForCheckSum:
# If written as pipe, only add SOH (ascii 1)
if c == "|":
sum += 1
else:
sum += ord(c)
sum = sum % 256
print(sum)