def connect(self, name, fn):
        """
        Connect a function ``fn`` to the template hook ``name``.

        An example hook could look like this::

            function my_hook(sender, **kwargs):
                # Get the request from context
                request = kwargs['context']['request']
                kwargs['content'].append("Hello, {0}!".format(request.user))

            registry.connect('hookname', name)

        If the given hook name does not exist at runtime, it is created
        dynamically.
        """

        with _registry_lock:
            try:
                signal = self._registry[name]
            except __HOLE__:
                signal = self.register(name)

        signal.connect(fn)
dataset/ETHPy150Open weluse/django-templatehooks/templatehooks/registry.py/HookRegistry.connect