code: def hook_focus_events(self):
          
          widget = self.widget
          widget.focusInEvent = self.focusInEvent
          widget.focusOutEvent = self.focusOutEvent
docs: Install the hooks for focus events.
  
          This method may be overridden by subclasses as needed.