code: def add_framework_listener(self, listener):
          
          if listener is None or not hasattr(listener, "framework_stopping"):
              raise BundleException("Invalid framework listener given")
  
          with self.__fw_lock:
              if listener in self.__fw_listeners:
                  self._logger.warning(
                      "Already known framework listener '%s'", listener
                  )
                  return False
  
              self.__fw_listeners.append(listener)
              return True
docs: Registers a listener that will be called back right before the
          framework stops.
  
          :param listener: The framework stop listener
          :return: True if the listener has been registered, False if it was
                   already known
          :raise BundleException: An invalid listener has been given