code: async def register_callback(self, cb):
          
          self._callbacks.add(cb)
  
          def unregister():
              self._callbacks.remove(cb)
  
          return unregister
docs: Allows the caller to register a callback, and returns a closure
          that can be used to unregister the provided callback