def set_callback(self, ref, callback):
<EOL>self.remove_callback(ref)<EOL>if callback is not None:<EOL><INDENT>self._callbacks[ref] = callback<EOL><DEDENT>
Sets a callback for a ref (reference), setting to None will remove it