code: def _draw_error_underline(self, ptx, pango_layout, start, stop):
          
  
          self.context.save()
          self.context.set_source_rgb(1.0, 0.0, 0.0)
  
          pit = pango_layout.get_iter()
  
          # Skip characters until start
          for i in xrange(start):
              pit.next_char()
  
          extents_list = []
  
          for char_no in xrange(start, stop):
              char_extents = pit.get_char_extents()
              underline_pixel_extents = [
                  char_extents[0] / pango.SCALE,
                  (char_extents[1] + char_extents[3]) / pango.SCALE - 2,
                  char_extents[2] / pango.SCALE,
                  4,
              ]
              if extents_list:
                  if extents_list[-1][1] == underline_pixel_extents[1]:
                      # Same line
                      extents_list[-1][2] = extents_list[-1][2] + \
                          underline_pixel_extents[2]
                  else:
                      # Line break
                      extents_list.append(underline_pixel_extents)
              else:
                  extents_list.append(underline_pixel_extents)
  
              pit.next_char()
  
          for extent in extents_list:
              pangocairo.show_error_underline(ptx, *extent)
  
          self.context.restore()
docs: Draws an error underline