@classmethod
def PushSingleton(cls, instance=None):
    """
        Pushes the given singleton to the top of the stack. The previous singleton will be restored
        when PopSingleton is called.

        :param Singleton instance:
            The singleton to install as the current one. If not given, a new singleton default
            is created.

        :rtype: Singleton
        :returns:
            The current singleton.
        """
    if instance is None:
        instance = cls.CreateDefaultSingleton()
    stack = cls._ObtainStack()
    stack.append(instance)
    return instance
