def block_iter(l, nblocks=2):
    blocksize = int(math.ceil(len(l) / float(nblocks)))
    i = 0
    while i < len(l):
        yield l[i:i+blocksize]
        i += blocksize
partitions l into nblocks blocks and returns generator over each block
dataset/ETHPy150Open sirrice/dbtruck/dbtruck/util.py/block_iter