code: def add_io_hook(self, hook):
          
          def proxy(*args):
              hook(*args)
  
          self._io_hooks.append(proxy)
  
          return self.HookRemover(lambda: self._io_hooks.remove(proxy))
docs: Args:
              hook:   This hook will be invoked for every incoming and outgoing CAN frame.
                      Hook arguments: (direction, frame)
                      See FRAME_DIRECTION_*, CANFrame.