Checks if this factory is able to create component by given locator.

        This method searches for all registered components and returns
        a locator for component it is able to create that matches the given locator.
        If the factory is not able to create a requested component is returns null.

        :param locator: a locator to identify component to be created.

        :return: a locator for a component that the factory is able to create.

def can_create(self, locator):
        """
        Checks if this factory is able to create component by given locator.

        This method searches for all registered components and returns
        a locator for component it is able to create that matches the given locator.
        If the factory is not able to create a requested component is returns null.

        :param locator: a locator to identify component to be created.

        :return: a locator for a component that the factory is able to create.
        """
        if locator == None:
            raise Exception("Locator cannot be null")
        
        # Iterate from the latest factories
        for factory in reversed(self._factories):
            locator = factory.can_create(locator)
            if locator != None:
                return locator
        
        return None