def substringUnpacker(s):

    pos = 0
    while len(s[pos:]):
        assert len(s[pos:]) >= sizeLength
        size = stringToUint(s[pos:pos + sizeLength])
        pos += sizeLength
        toYield = s[pos:pos + size]
        if len(toYield) != size:
            raise MessageException(("corrupt read, size was %s, but string " +
                                    "len was %s") % (size, len(toYield)))

        yield toYield
        pos += size
reads in a string that contains a number of substrings, each
dataset/ETHPy150Open ufora/ufora/ufora/distributed/ServerUtils/SimpleServer.py/substringUnpacker