code: def shard(items, num_shards):
    
    sharded = []
    num_per_shard = len(items) // num_shards
    start = 0
    for _ in range(num_shards):
      sharded.append(items[start:start + num_per_shard])
      start += num_per_shard
  
    remainder = len(items) % num_shards
    start = len(items) - remainder
    for i in range(remainder):
      sharded[i].append(items[start + i])
  
    assert sum([len(fs) for fs in sharded]) == len(items)
    return sharded
docs: Split items into num_shards groups.