code: def model_changed(self, model):
          
          callbacks = [cb for cbs in self.traverse(lambda x: x.callbacks)
                       for cb in cbs]
          stream_metadata = [stream._metadata for cb in callbacks
                             for stream in cb.streams if stream._metadata]
          return any(md['id'] == model.ref['id'] for models in stream_metadata
                     for md in models.values())
docs: Determines if the bokeh model was just changed on the frontend.
          Useful to suppress boomeranging events, e.g. when the frontend
          just sent an update to the x_range this should not trigger an
          update on the backend.