def unpad_body(body):
    """ Pad a Sphinx message body. """
    body = bytes(body)
    l = len(body) - 1
    x_marker = bytes(b'\x7f')[0]
    f_marker = bytes(b'\xff')[0]
    while body[l] == f_marker and l > 0:
        l -= 1
    if body[l] == x_marker:
        ret = body[:l]
    else:
        ret = b''
    return ret
