docs: def draw_panel(self, surf):
      """Draw the unit selection or build queue."""
  
      left = -12  # How far from the right border
  
      def unit_name(unit_type):
        return self._static_data.units.get(unit_type, "<unknown>")
  
      def write(loc, text, color=colors.yellow):
        surf.write_screen(self._font_large, color, loc, text)
  
      def write_single(unit, line):
        write((left + 1, next(line)), unit_name(unit.unit_type))
        write((left + 1, next(line)), "Health: %s" % unit.health)
        write((left + 1, next(line)), "Shields: %s" % unit.shields)
        write((left + 1, next(line)), "Energy: %s" % unit.energy)
        if unit.build_progress > 0:
          write((left + 1, next(line)),
                "Progress: %d%%" % (unit.build_progress * 100))
        if unit.transport_slots_taken > 0:
          write((left + 1, next(line)), "Slots: %s" % unit.transport_slots_taken)
  
      def write_multi(units, line):
        counts = collections.defaultdict(int)
        for unit in units:
          counts[unit_name(unit.unit_type)] += 1
        for name, count in sorted(counts.items()):
          y = next(line)
          write((left + 1, y), count)
          write((left + 3, y), name)
  
      ui = self._obs.observation.ui_data
      line = itertools.count(3)
  
      if ui.groups:
        write((left, next(line)), "Control Groups:", colors.green)
        for group in ui.groups:
          y = next(line)
          write((left + 1, y), "%s:" % group.control_group_index, colors.green)
          write((left + 3, y), "%s %s" % (group.count,
                                          unit_name(group.leader_unit_type)))
        next(line)
  
      if ui.HasField("single"):
        write((left, next(line)), "Selection:", colors.green)
        write_single(ui.single.unit, line)
      elif ui.HasField("multi"):
        write((left, next(line)), "Selection:", colors.green)
        write_multi(ui.multi.units, line)
      elif ui.HasField("cargo"):
        write((left, next(line)), "Selection:", colors.green)
        write_single(ui.cargo.unit, line)
        next(line)
        write((left, next(line)), "Cargo:", colors.green)
        write((left + 1, next(line)),
              "Empty slots: %s" % ui.cargo.slots_available)
        write_multi(ui.cargo.passengers, line)
      elif ui.HasField("production"):
        write((left, next(line)), "Selection:", colors.green)
        write_single(ui.production.unit, line)
        next(line)
        write((left, next(line)), "Build Queue:", colors.green)
        for unit in ui.production.build_queue:
          s = unit_name(unit.unit_type)
          if unit.build_progress > 0:
            s += ": %d%%" % (unit.build_progress * 100)
          write((left + 1, next(line)), s)