def __new__(
        cls: Type[SingletonPerName],
        *args,
        name: Optional[str] = None,
        **kwargs,
    ) -> SingletonPerName:
        """
        Create the singleton instance if it doesn't already exist and return it.
        """

        k = cls.__name__, name

        if k not in cls._instances:
            logger.debug(
                "*** Creating new %s singleton instance for name = %s ***",
                cls.__name__,
                name,
            )
            # If exception happens here, the instance should not be added to
            # _instances.
            instance = super().__new__(cls)

            SingletonPerName._id_to_name_map[id(instance)] = name
            info: SingletonInfo = SingletonInfo(name=name, val=instance)
            SingletonPerName._instances[k] = info
        else:
            info = SingletonPerName._instances[k]
        obj = info.val
        assert isinstance(obj, cls)
        return obj

        Create the singleton instance if it doesn't already exist and return it.
        
src/trulens_eval/trulens_eval/utils/python.py