human
I wrote the below code

    num_shards = (len(vocab) / FLAGS.shard_size)
    ix = 0
    for ((row, col), fh) in shardfiles.iteritems():
        ix += 1
        sys.stdout.write(('\rwriting    shard    %d/%d' % (ix, len(shardfiles))))
        sys.stdout.flush()
        fh.seek(0)
        buf = fh.read()
        os.unlink(fh.name)
        fh.close()
        coocs = [shard_cooc_fmt.unpack_from(buf, off) for off in range(0, len(buf), shard_cooc_fmt.size)]
        coocs.sort()
        if coocs:
            current_pos = 0
            current_row_col = (coocs[current_pos][0], coocs[current_pos][1])
            for next_pos in range(1, len(coocs)):
                next_row_col = (coocs[next_pos][0], coocs[next_pos][1])
                if (current_row_col == next_row_col):
                    coocs[current_pos] = (coocs[current_pos][0], coocs[current_pos][1], (coocs[current_pos][2] + coocs[next_pos][2]))
                else:
                    current_pos += 1
                    if (current_pos < next_pos):
                        coocs[current_pos] = coocs[next_pos]
                    current_row_col = (coocs[current_pos][0], coocs[current_pos][1])
            coocs = coocs[:(1 + current_pos)]
        def _int64s(xs):
            return tf.train.Feature(int64_list=tf.train.Int64List(value=list(xs)))
        def _floats(xs):
            return tf.train.Feature(float_list=tf.train.FloatList(value=list(xs)))
        example = tf.train.Example(features=tf.train.Features(feature={'global_row': _int64s(((row + (num_shards * i)) for i in range(FLAGS.shard_size))), 'global_col': _int64s(((col + (num_shards * i)) for i in range(FLAGS.shard_size))), 'sparse_local_row': _int64s((cooc[0] for cooc in coocs)), 'sparse_local_col': _int64s((cooc[1] for cooc in coocs)), 'sparse_value': _floats((cooc[2] for cooc in coocs))}))
        filename = os.path.join(FLAGS.output_dir, ('shard-%03d-%03d.pb' % (row, col)))
        with open(filename, 'w') as out:
            out.write(example.SerializeToString())
    sys.stdout.write('\n')

What's a good function header?

Here's a good function header?
assistant
#Here's a good function header.

def write_shards(vocab, shardfiles):