def register_provider(self, func):
        """
        Register a provider function.
        """
        if 'provides' not in getattr(func, '__di__', {}):
            raise DiayException('function %r is not a provider' % func)

        self.factories[func.__di__['provides']] = func