docs: def register_plugin(host, plugin):
      """
      Register a plugin with a host object. Some @pluggable methods in the host
      will have their behaviour altered by the plugin.
      """
      class OriginalMethods(object):
          def __getattr__(self, name):
              return lambda *args, **kwargs: getattr(host, name).original(host, *args, **kwargs)
      if not hasattr(host, "_plugins"):
          host._plugins = [OriginalMethods()]
      plugin.parent = host._plugins[-1]
      plugin.host = host
      host._plugins.append(plugin)