def METHOD_NAME(batch_size, max_frames, channel_dim, type):
    type = test_utils.dali_type_to_np(type)
    assert max_frames is not None or channel_dim != 1
    def generate():
        batch = []
        for _ in range(batch_size):
            frames = None if max_frames is None else np.random.randint(1, max_frames + 1)
            sz = np.random.randint(100, 2000 / (max_frames or 1))
            w, h = np.random.randint(sz, 2 * sz, [2])
            batch.append(generate_data(frames, w, h, channel_dim, type))
        return batch
    return generate