code: def add_bundle_listener(self, listener):
          
          if listener is None or not hasattr(listener, "bundle_changed"):
              raise BundleException("Invalid bundle listener given")
  
          with self.__bnd_lock:
              if listener in self.__bnd_listeners:
                  self._logger.warning(
                      "Already known bundle listener '%s'", listener
                  )
                  return False
  
              self.__bnd_listeners.append(listener)
              return True
docs: Adds a bundle listener
  
          :param listener: The bundle listener to register
          :return: True if the listener has been registered, False if it was
                   already known
          :raise BundleException: An invalid listener has been given