code: def hook_decorator(cb_type):
      
      def decorator_wrapper(*tags_or_func):
          if len(tags_or_func) == 1 and callable(tags_or_func[0]):
              # No tags were passed to this decorator
              func = tags_or_func[0]
              return HookImpl(cb_type, func)
          else:
              # We got some tags, so we need to produce the real decorator
              tags = tags_or_func
              def d(func):
                  return HookImpl(cb_type, func, tags)
              return d
      return decorator_wrapper
docs: Decorator to wrap hook definitions in. Registers hook.