human
Can you provide a Python code to fix in suffixes: given the following:
I wrote the below code

    def walk_datadir(datadir, node_id):
        partitions = os.listdir(datadir)
        random.shuffle(partitions)
        for partition in partitions:
            part_dir = os.path.join(datadir, partition)
            if (not os.path.isdir(part_dir)):
                continue
            suffixes = os.listdir(part_dir)
            if (not suffixes):
                os.rmdir(part_dir)
                continue
            for suffix in suffixes:
                suff_dir = os.path.join(part_dir, suffix)
                if (not os.path.isdir(suff_dir)):
                    continue
                hashes = os.listdir(suff_dir)
                if (not hashes):
                    os.rmdir(suff_dir)
                    continue
                for hsh in hashes:
                    hash_dir = os.path.join(suff_dir, hsh)
                    if (not os.path.isdir(hash_dir)):
                        continue
                    object_file = os.path.join(hash_dir, (hsh + '.db'))
                    if os.path.exists(object_file):
                        (yield (partition, object_file, node_id))
                    else:
                        try:
                            os.rmdir(hash_dir)
                        except OSError as e:
                            if (e.errno is not errno.ENOTEMPTY):
                                raise
    its = [walk_datadir(datadir, node_id) for (datadir, node_id) in datadirs]
    while its:
        for it in its:
            try:
                (yield next(it))
            except StopIteration:
                its.remove(it)

What's a good function header?
assistant
#Here is Python code to fix in suffixes:
.

def roundrobin_datadirs(datadirs):