A decorator to register a factory on the container.
    For more information see :meth:`Container.add_factory`.

def factory(container, name=None):
    """A decorator to register a factory on the container.
    For more information see :meth:`Container.add_factory`.
    """
    def register(factory):
        container.add_factory(factory, name)
        return factory

    return register