code: def show_mode_indicator(viewer, tf, corner='ur'):
      
      tag = '_$mode_indicator'
  
      canvas = viewer.get_private_canvas()
      try:
          indic = canvas.get_object_by_tag(tag)
          if not tf:
              canvas.delete_object_by_tag(tag)
          else:
              indic.corner = corner
  
      except KeyError:
          if tf:
              # force a redraw if the mode changes
              bm = viewer.get_bindmap()
              bm.add_callback('mode-set',
                              lambda *args: viewer.redraw(whence=3))
  
              Indicator = canvas.get_draw_class('modeindicator')
              canvas.add(Indicator(corner=corner),
                         tag=tag, redraw=False)
  
      canvas.update_canvas(whence=3)
docs: Show a keyboard mode indicator in one of the corners.
  
      Parameters
      ----------
      viewer : an ImageView subclass instance
          If True, show the color bar; else remove it if present.
  
      tf : bool
          If True, show the mark; else remove it if present.
  
      corner : str
          One of 'll', 'lr', 'ul' or 'ur' selecting a corner.
          The default is 'ur'.