<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def stats_per_chunk(chunk):
 """Given a chunk, increment the block types with the number of blocks found"""


    for block_id in chunk.iter_block():
        try:
            block_counts[block_id] += 1
        except KeyError:
            block_counts[block_id] = 1