You are building a data loader that emits items by drawing from several datasets according to integer weights, and that can be saved and resumed deterministically using a single integer offset.
Implement the function weighted_batcher(datasets, weights, num_samples, start_offset=0) that returns a list of emitted items following this exact rule.
Setup:
To emit ONE item, perform these steps:
The batcher conceptually emits num_samples items in total. The start_offset argument means: skip the first start_offset emitted items and return only the remaining items as a list. In other words, calling the function with a given start_offset must return exactly the tail of the full sequence that begins at index start_offset. If start_offset >= num_samples, return an empty list.