code: def build_colormap():
      """Builds a colormap function that maps labels to colors.
  
      Returns:
          Function that receives a label and returns a color tuple `(R, G, B)`
          for said label.
      """
      # Build the 10-color palette to be used for all classes. The following are
      # the hex-codes for said colors (taken the default 10-categorical d3 color
      # palette).
      palette = (
          "1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"
      )
      colors = [
          hex_to_rgb(palette[i : i + 6])
          for i in range(0, len(palette), 6)
      ]
  
      seen_labels = {}
  
      def colormap(label):
          # If label not yet seen, get the next value in the palette sequence.
          if label not in seen_labels:
              seen_labels[label] = colors[
                  len(seen_labels) % len(colors)
              ]
  
          return seen_labels[label]
  
      return colormap
  
file_path: luminoth/luminoth/vis.py
imports: import numpy
  import sys
  from PIL import Image, ImageDraw, ImageFont
label_desc: Use image node_id 3 for calling a global function with example usage: build_colormap() and returns: colormap, seen_labels