def generate_chunks(container, size):
    'Given a container, generate chunks from it with size up to `size`\n    '
    assert (size > 0), 'Size should be non-0 positive'
    while container:
        (yield container[:size])
        container = container[size:]
Given a container, generate chunks from it with size up to `size`
def generate_chunks(container, size):
    '\n    '
    assert (size > 0), 'Size should be non-0 positive'
    while container:
        (yield container[:size])
        container = container[size:]