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