def gen_minibatch(items, bs):
    """Split big list into minibatches"""
    total = len(items)
    for start in range(0, total, bs):
        end = min(start + bs, total)
        batch = items[start:end]
        yield batch, start, end
