def delete_singleton_by_name(
        name: str,
        cls: Optional[Type[Any]] = None,  # Any is the type with this as meta
    ):
        """Delete the singleton instance with the given name.

        This can be used for testing to create another singleton.

        Args:
            name: The name of the singleton instance to delete.

            cls: The class of the singleton instance to delete. If not given, all
                instances with the given name are deleted.
        """

        for k, v in list(SingletonPerNameMeta._singleton_instances.items()):
            if k[1] == name:
                if cls is not None and v.__class__ is not cls:
                    continue

                del SingletonPerNameMeta._singleton_instances[k]
Delete the singleton instance with the given name.

        This can be used for testing to create another singleton.

        Args:
            name: The name of the singleton instance to delete.

            cls: The class of the singleton instance to delete. If not given, all
                instances with the given name are deleted.
        
src/core/trulens/core/utils/python.py