code: def wait_for_snapshot(paths, f=lambda: None):
      if isinstance(paths, str):
          paths = [paths]
      while not all(
          [
              snapshot_is_done(path) or snapshot_has_error(path)
              for path in paths
          ]
      ):
          f()
          time.sleep(0.1)
  
imports: import collections
  import os
  import pathlib
  import time
  from absl.testing import parameterized
  from tensorflow.python.data.experimental.kernel_tests.service import test_base
  from tensorflow.python.data.experimental.ops import distributed_save_op
  from tensorflow.python.data.experimental.service import _pywrap_snapshot_utils
  from tensorflow.python.data.kernel_tests import test_base
  from tensorflow.python.data.ops import dataset_ops
  from tensorflow.python.framework import combinations
  from tensorflow.python.framework import errors
  from tensorflow.python.platform import test
label_desc: Use image node_id 7 for calling a global function with example usage: wait_for_snapshot(paths, f) without return types