def from_string( raw_bytes, offset, count = 0 ):
    """ Converts a sequence of NUL-terminated bytes to a Python string. """

    s_out = ""
    i = 0

    while True:
        c = raw_bytes[ offset + i ]
        if 0 == c: break
        s_out += chr( c )
        i += 1
        if count and (i == count): break

    return s_out, i