code: def _convert_roi_to_render_data(
      roi: RegionOfInterest,
  ) -> _RenderDataProto:
      """Converts region of interest to render data proto."""
      result = _RenderDataProto()
  
      if roi is not None:
          if roi.format == RegionOfInterest.Format.UNSPECIFIED:
              raise ValueError("RegionOfInterest format not specified.")
  
          elif roi.format == RegionOfInterest.Format.KEYPOINT:
              if roi.keypoint is not None:
                  annotation = result.render_annotations.add()
                  annotation.color.r = 255
                  point = annotation.point
                  point.normalized = True
                  point.x = roi.keypoint.x
                  point.y = roi.keypoint.y
                  return result
      else:
          raise ValueError(
              "Please specify the Region-of-interest for segmentation."
          )
  
      raise ValueError("Unrecognized format.")
  
imports: import dataclasses
  import enum
  from typing import List, Optional
  from mediapipe.python import packet_creator
  from mediapipe.python import packet_getter
  from mediapipe.python._framework_bindings import image
  from mediapipe.tasks.cc.vision.image_segmenter.proto import image_segmenter_graph_options_pb2
  from mediapipe.tasks.cc.vision.image_segmenter.proto import segmenter_options_pb2
  from mediapipe.tasks.python.components.containers import keypoint
  from mediapipe.tasks.python.core import base_options
  from mediapipe.tasks.python.core import task_info
  from mediapipe.tasks.python.core.optional_dependencies import doc_controls
  from mediapipe.tasks.python.vision.core import base_vision_task_api
  from mediapipe.tasks.python.vision.core import image_processing_options
  from mediapipe.tasks.python.vision.core import vision_task_running_mode
  from mediapipe.util import render_data_pb2
label_desc: Use image node_id 1 for calling a global function with example usage: _convert_roi_to_render_data(roi) and returns: result