code: def test_flush_synced_with_fn(self) -> None:
      class SomeModel(Model, Local):
          child = Nullable(Instance(Model), default=None)
  
      child0 = SomeModel()
      child1 = SomeModel()
      child2 = SomeModel(child=child0)
      d = Document()
      d.add_root(child0)
      d.add_root(child1)
      d.add_root(child2)
  
      assert d.models._new_models == {child0, child1, child2}
      assert d.models.synced_references == set()
      d.models.flush_synced(lambda model: model.child is not None)
      assert d.models._new_models == {child2}
      assert d.models.synced_references == {child0, child1}
  
imports: from __future__ import annotations
  import pytest
  import gc
  from unittest.mock import MagicMock, patch
  from bokeh.core.has_props import Local
  from bokeh.core.properties import Instance, Nullable
  from bokeh.core.types import ID
  from bokeh.document import Document
  from bokeh.model import Model
  from bokeh.models import Div, Row
  import bokeh.document.models
label_desc: Use image node_id 16 for calling the TestDocumentModelManager obj's underlying member method code with example usage: obj.test_flush_synced_with_fn() without return types