def notify_observers(self, device=None, attributes=None):
        """notify observers """
        log.debug("%s %r", device, attributes)
        for observer, devices in list(self._observers.items()):
            #log.debug("trying to notify the observer")
            if devices is None or device is None or device in devices:
                try:
                    observer(self, device, attributes)
                except (Exception,) as ex:  # pylint: disable=W0703
                    self.unregister_observer(observer)
                    errmsg = "Exception in message dispatch: Handler '{0}'" + \
                        " unregistered for device '{1}'  ".format(
                                        observer.__class__.__name__, device)
                    log.error(errmsg, exc_info=ex)