code: def builder_init(is_read_only_builder: bool = False) -> _Decorator:
      """Decorator to call `builder_init` method on registered loggers."""
  
      @wrapt.decorator
      def decorator(function, dsbuilder, args, kwargs):
          metadata = call_metadata.CallMetadata()
          _thread_id_to_builder_init_count[metadata.thread_id] += 1
          try:
              return function(*args, **kwargs)
          except Exception:
              metadata.mark_error()
              raise
          finally:
              if (
                  _thread_id_to_builder_init_count[metadata.thread_id]
                  == 1
              ):
                  metadata.mark_end()
                  data_dir = kwargs.get("data_dir")
                  config = kwargs.get("config")
                  if config is not None:
                      config = str(config)
                  version = kwargs.get("version")
                  if version is not None:
                      version = str(version)
                  for logger in _get_registered_loggers():
                      logger.builder_init(
                          metadata=metadata,
                          name=dsbuilder.name,
                          data_dir=data_dir,
                          config=config,
                          version=version,
                          is_read_only_builder=is_read_only_builder,
                      )
              _thread_id_to_builder_init_count[metadata.thread_id] -= 1
  
      return decorator
  
imports: import abc
  import atexit
  import collections
  import functools
  import threading
  from typing import Any, Callable, Dict, List, Optional, Tuple, TypeVar
  from absl import flags
  from tensorflow_datasets.core.logging import base_logger
  from tensorflow_datasets.core.logging import call_metadata
  from tensorflow_datasets.core.logging import logging_logger
  import wrapt
label_desc: Use image node_id 7 for calling a global function with example usage: builder_init(is_read_only_builder) and returns: decorator, function