code: def _write_image_level_labels(fname, image_ids, machine=False):
      """Writes CSV with 0-10 labels per image."""
      lines = ["ImageID,Source,LabelName,Condidence"]
      all_class_label = ClassLabel(
          names_file=utils.tfds_write_path(
              os.path.join(
                  "object_detection", "open_images_classes_all.txt"
              )
          )
      )
      trainable_class_label = ClassLabel(
          names_file=utils.tfds_write_path(
              os.path.join(
                  "object_detection",
                  "open_images_classes_trainable.txt",
              )
          )
      )
      for i, image_id in enumerate(image_ids):
          if i < 1:
              # Ensure that at least some image contains trainable classes.
              labels = random.sample(
                  trainable_class_label.names, random.randint(0, 10)
              )
          else:
              labels = random.sample(
                  all_class_label.names, random.randint(0, 10)
              )
          for label in labels:
              source = random.choice(open_images.IMAGE_LEVEL_SOURCES)
              confidence = random.choice((0, 1))
              if machine:
                  confidence = "%.1f" % (random.randint(0, 10) / 10.0)
              else:
                  confidence = random.choice((0, 1))
              lines.append(
                  "%s,%s,%s,%s" % (image_id, source, label, confidence)
              )
      path = os.path.join(_output_dir(), fname)
      with open(path, "w") as csv_f:
          csv_f.write("\n".join(lines))
  
file_path: datasets/tensorflow_datasets/testing/fake_data_generation/open_images.py
imports: import os
  import random
  import tarfile
  from absl import app
  from absl import flags
  from tensorflow_datasets.core import utils
  from tensorflow_datasets.core.features import ClassLabel
  from tensorflow_datasets.object_detection import open_images
  from tensorflow_datasets.testing import fake_data_utils
label_desc: Use image node_id 4 for calling a global function with example usage: _write_image_level_labels(fname, image_ids, machine) without return types