def add_cb(self, cb):
    old = getattr(self, cb.name, None)
    assert ((not old) or isinstance(old, type(cb))), f'self.{cb.name} already registered'
    cb.learn = self
    setattr(self, cb.name, cb)
    self.cbs.append(cb)
    return self
def add_cb(self, cb):
    old = getattr(self, cb.name, None)
    assert ((not old) or isinstance(old, type(cb))), f'self.{cb.name} already registered'
    cb.learn = self
    setattr(self, cb.name, cb)
    self.cbs.append(cb)
    return self