def unregister(self, path, watch_type=None, watcher=None, handler=None):
    """Removes an existing watch or handler.

    This unregisters an object's watch and handler callback functions. It
    doesn't actually prevent the watch or handler from triggering but it
    does remove all references fromo the object and prevent the functions
    from being called. This allows garbage collection of the object.

    Args:
      path: The znode being watched.
      watch_type: Type of watcher to unregister - must be in (core.WATCH_DATA, core.WATCH_CHILDREN)
      watcher: The watcher function that should be removed.
      handler: The handler function that should be removed.

    Returns:
      Nothing.
    """
    
    if watch_type is core.WATCH_CHILDREN:
        watches = self._children_watches
        handlers = self._children_handlers
    else:
        watches = self._watches
        handlers = self._handlers
    
    if watcher:
      try:
        while True:
          watches.get(path, []).remove(watcher)
      except ValueError:
        pass
    if handler:
      try:
        while True:
          handlers.get(path, []).remove(handler)
      except __HOLE__:
        pass
dataset/ETHPy150Open liquidgecka/twitcher/twitcher/zkwrapper.py/ZKWrapper.unregister