def generate_key(self, key_image_fname='key'):
    img = Image.new('RGB', (self._KEY_WIDTH, self._KEY_HEIGHT), 'black')
    draw = ImageDraw.Draw(img)
    font = ImageFont.load_default()
    yt = 0
    for (operation, color) in chain([(stall_bubble, self.stall_bubble_color[stall_bubble]) for stall_bubble in self._STALLS_LIST], [('unified_instr', self.unified_instr_color), ('unified_fp_instr', self.unified_fp_instr_color)]):
        (font_height, font_width) = font.getsize(operation)
        yb = (yt + font_width)
        draw.rectangle([0, yt, 64, yb], color)
        draw.text((68, yt), operation, (255, 255, 255))
        yt += font_width
    mode = ('abstract' if self.abstract else 'detailed')
    img.save('{}.png'.format(((key_image_fname + '_') + mode)))
    return
def generate_key(self, key_image_fname='key'):
    img = Image.new('RGB', (self._KEY_WIDTH, self._KEY_HEIGHT), 'black')
    draw = ImageDraw.Draw(img)
    font = ImageFont.load_default()
    yt = 0
    for (operation, color) in chain([(stall_bubble, self.stall_bubble_color[stall_bubble]) for stall_bubble in self._STALLS_LIST], [('unified_instr', self.unified_instr_color), ('unified_fp_instr', self.unified_fp_instr_color)]):
        (font_height, font_width) = font.getsize(operation)
        yb = (yt + font_width)
        draw.rectangle([0, yt, 64, yb], color)
        draw.text((68, yt), operation, (255, 255, 255))
        yt += font_width
    mode = ('abstract' if self.abstract else 'detailed')
    img.save('{}.png'.format(((key_image_fname + '_') + mode)))
    return