a block generator for pprp

def blockgen(bytes, block_size=16):
    ''' a block generator for pprp '''
    for i in range(0, len(bytes), block_size):
        block = bytes[i:i + block_size]
        block_len = len(block)
        if block_len > 0:
            yield block
        if block_len < block_size:
            break