code: def _generate_annotation(example_id, height, width):
      """Generate a fake annotation XML for the given example id."""
      # pylint: disable=protected-access
      label_names = tfds.features.ClassLabel(
          names=voc._VOC2007_LABELS
      ).names  # pytype: disable=module-attr
      pose_names = tfds.features.ClassLabel(
          names=voc._VOC2007_POSES
      ).names  # pytype: disable=module-attr
      # pylint: enable=protected-access
      annotation = "<annotation>\n"
      annotation += "<size>\n"
      annotation += "<width>%d</width>\n" % width
      annotation += "<height>%d</height>\n" % height
      annotation += "</size>\n"
      for i in range(random.randint(MIN_NUM_OBJECTS, MAX_NUM_OBJECTS)):
          annotation += "<object>\n"
          annotation += "  <name>%s</name>\n" % random.choice(
              label_names
          )
          annotation += "  <pose>%s</pose>\n" % random.choice(
              pose_names
          )
          annotation += (
              "  <truncated>%s</truncated>\n" % random.randint(0, 1)
          )
          if i > 0:
              annotation += (
                  "  <difficult>%s</difficult>\n" % random.randint(0, 1)
              )
          else:
              annotation += "  <difficult>0</difficult>\n"
          obj_w = random.randint(
              MIN_OBJECT_HEIGHT_WIDTH, MAX_OBJECT_HEIGHT_WIDTH
          )
          obj_h = random.randint(
              MIN_OBJECT_HEIGHT_WIDTH, MAX_OBJECT_HEIGHT_WIDTH
          )
          obj_x = random.randint(0, width - obj_w)
          obj_y = random.randint(0, height - obj_h)
          annotation += "  <bndbox>\n"
          annotation += "  <xmin>%d</xmin>\n" % obj_x
          annotation += "  <ymin>%d</ymin>\n" % obj_y
          annotation += "  <xmax>%d</xmax>\n" % (obj_x + obj_w - 1)
          annotation += "  <ymax>%d</ymax>\n" % (obj_y + obj_h - 1)
          annotation += "  </bndbox>\n"
          annotation += "</object>\n"
      annotation += "</annotation>\n"
      # Add annotation XML to the tar file.
      filepath = os.path.join(
          _voc2007_output_dir(),
          "VOCdevkit/VOC2007/Annotations/%06d.xml" % example_id,
      )
      _write_text_file(filepath, annotation)
  
file_path: datasets/tensorflow_datasets/testing/fake_data_generation/voc2007.py
imports: import os
  import random
  from absl import app
  from absl import flags
  from tensorflow_datasets.core import utils
  from tensorflow_datasets.core.utils.lazy_imports_utils import tensorflow
  from tensorflow_datasets.object_detection import voc
  import tensorflow_datasets.public_api
  from tensorflow_datasets.testing import fake_data_utils
label_desc: Use image node_id 4 for calling a global function with example usage: _generate_annotation(example_id, height, width) without return types