code: def onWith(self, evnt, func):
          '''
          A context manager which can be used to add a callback and remove it when
          using a ``with`` statement.
  
          Args:
              evnt (str):         An event name
              func (function):    A callback function to receive event tufo
          '''
          self.on(evnt, func)
          # Allow exceptions to propagate during the context manager
          # but ensure we cleanup our temporary callback
          try:
              yield self
          finally:
              self.off(evnt, funcf onWith(self, evnt, func):
          '''
          A context manager which can be used to add a callback and remove it when
          using a ``with`` statement.
  
          Args:
              evnt (str):         An event name
              func (function):    A callback function to receive event tufo
          '''
          self.on(evnt, func)
          # Allow exceptions to propagate during the context manager
          # but ensure we cleanup our temporary callback
          try:
              yield self
          finally:
              self.off(evnt, func)
docs: A context manager which can be used to add a callback and remove it when
          using a ``with`` statement.
  
          Args:
              evnt (str):         An event name
              func (function):    A callback function to receive event tufo