def METHOD_NAME(self, old, new):
    # This is used to attach a listener to the datasource so that when
    # its metadata has been updated, we catch the event and update properly
    if not self.plot:
        return
    datasource = getattr(self.plot, self.axis)
    if old:
        datasource.observe(
            self._metadata_change_handler, "metadata_changed", remove=True
        )
    if new:
        datasource.observe(
            self._metadata_change_handler, "metadata_changed"
        )