<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def delete_framework(cls, framework=None):
 # type: (Optional[Framework]) -> bool # pylint: disable=W0212 """ Removes the framework singleton :return: True on success, else False """

        if framework is None:
            framework = cls.__singleton

        if framework is cls.__singleton:
            # Stop the framework
            try:
                framework.stop()
            except:
                _logger.exception("Error stopping the framework")

            # Uninstall its bundles
            bundles = framework.get_bundles()
            for bundle in bundles:
                try:
                    bundle.uninstall()
                except:
                    _logger.exception(
                        "Error uninstalling bundle %s",
                        bundle.get_symbolic_name(),
                    )

            # Clear the event dispatcher
            framework._dispatcher.clear()

            # Clear the singleton
            cls.__singleton = None
            return True

        return False