def _chunk_actions(actions, chunk_size, max_chunk_bytes, serializer):
    bulk_actions = []
    size, action_count = 0, 0
    for action, data in actions:
        action = serializer.dumps(action)
        cur_size = len(action) + 1

        if data is not None:
            data = serializer.dumps(data)
            cur_size += len(data) + 1

        # full chunk, send it and start a new one
        if bulk_actions and (size + cur_size > max_chunk_bytes or action_count == chunk_size):
            yield bulk_actions
            bulk_actions = []
            size, action_count = 0, 0

        bulk_actions.append(action)
        if data is not None:
            bulk_actions.append(data)
        size += cur_size
        action_count += 1

    if bulk_actions:
        yield bulk_actions
Open the given filename and return the workbook
dataset/ETHPy150Open elastic/elasticsearch-py/elasticsearch/helpers/__init__.py/_chunk_actions--crossover with--dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/openpyxl-2.3.0-b2/openpyxl/reader/excel.py/load_workbook