code: def add_callback(instance, prop, callback, echo_old=False, priority=0):
      
      p = getattr(type(instance), prop)
      if not isinstance(p, CallbackProperty):
          raise TypeError("%s is not a CallbackProperty" % prop)
      p.add_callback(instance, callback, echo_old=echo_old, priority=priority)
docs: Attach a callback function to a property in an instance
  
      Parameters
      ----------
      instance
          The instance to add the callback to
      prop : str
          Name of callback property in `instance`
      callback : func
          The callback function to add
      echo_old : bool, optional
          If `True`, the callback function will be invoked with both the old
          and new values of the property, as ``func(old, new)``. If `False`
          (the default), will be invoked as ``func(new)``
      priority : int, optional
          This can optionally be used to force a certain order of execution of
          callbacks (larger values indicate a higher priority).
  
      Examples
      --------
  
      ::
  
          class Foo:
              bar = CallbackProperty(0)
  
          def callback(value):
              pass
  
          f = Foo()
          add_callback(f, 'bar', callback)