docs: def valuedispatch(func):
      """Decorates a function to dispatch handler of the value of the first
      argument.
      """
      registry = {}
      def dispatch(value):
          return registry.get(value, func)
      def register(value, func=None):
          if func is None:
              return lambda f: register(value, f)
          registry[value] = func
          return func
      def wrapper(*args, **kw):
          return dispatch(args[0])(*args, **kw)
      wrapper.register = register
      wrapper.dispatch = dispatch
      wrapper.registry = MappingProxyType(registry)
      update_wrapper(wrapper, func)
      return wrapper