@contextlib.contextmanager
def batch_update(self):
    assert (not self._is_batch)
    self._is_batch = True
    self._batch_scene_updated = False
    self._batch_vars = {}
    (yield)
    if self._batch_scene_updated:
        self._send_scene()
    elif self._batch_vars:
        self._send_remote_var([(name, val) for (name, val) in self._batch_vars.items()])
    self._is_batch = False
    self._batch_scene_updated = False
    self._batch_vars = None
@contextlib.contextmanager
def batch_update(self):
    assert (not self._is_batch)
    self._is_batch = True
    self._batch_scene_updated = False
    self._batch_vars = {}
    (yield)
    if self._batch_scene_updated:
        self._send_scene()
    elif self._batch_vars:
        self._send_remote_var([(name, val) for (name, val) in self._batch_vars.items()])
    self._is_batch = False
    self._batch_scene_updated = False
    self._batch_vars = None