code: def _gen_init_files(
      output_dir: str,
      output_package: str,
      api_version: int,
      symbols_by_module: Mapping[str, set[_Entrypoint]],
      generated_imports_by_module: Mapping[str, set[str]],
      docs_by_module: Mapping[str, str],
      root_template_path: str,
      file_prefixes_to_strip: Sequence[str],
      use_lazy_loading: bool,
      module_prefix: str,
      output_files: Set[str],
      subpackage_rewrite: Optional[str] = None,
      root_file_name="__init__.py",
  ):
      """Generates the __init__.py files for the given API version."""
      modules = set(symbols_by_module.keys())
      modules.update(generated_imports_by_module.keys())
      for module in modules:
          if len(module) < len(output_package):
              continue
          module_relative_to_package = module[len(output_package) + 1 :]
          module_path = os.path.join(
              output_dir, module_relative_to_package.replace(".", "/")
          )
          os.makedirs(module_path, exist_ok=True)
          module_file_path = os.path.join(
              module_path,
              root_file_name
              if not module_relative_to_package
              else "__init__.py",
          )
          module_file_path = os.path.normpath(module_file_path)
          if module_file_path not in output_files:
              raise AssertionError(
                  f'Exported api attempted to write to "{module_file_path}" but it is'
                  " not in output_files."
              )
          with open(module_file_path, "w") as f:
              module_imports = _get_imports_for_module(
                  module,
                  output_package,
                  symbols_by_module,
                  generated_imports_by_module,
                  file_prefixes_to_strip,
                  module_prefix,
                  use_lazy_loading,
                  subpackage_rewrite,
              )
              if use_lazy_loading:
                  module_imports = (
                      _LAZY_LOADING_MODULE_TEXT_TEMPLATE
                      % module_imports
                  )
              # If this module is the root and there is a root template, use it
              if module == output_package and root_template_path:
                  with open(root_template_path, "r") as template:
                      content = template.read()
                      content = content.replace(
                          "# API IMPORTS PLACEHOLDER", module_imports
                      )
  
                      underscore_elements = [
                          s.name
                          for s in symbols_by_module[module]
                          if s.name.startswith("_")
                      ]
                      for i in generated_imports_by_module[module]:
                          module_name = i[i.rfind(".") + 1 :]
                          if module_name.startswith("_"):
                              underscore_elements.append(module_name)
  
                      root_module_footer = f"""
  _names_with_underscore = [{', '.join(sorted([f"'{s}'" for s in underscore_elements]))}]
  __all__ = [_s for _s in dir() if not _s.startswith('_')]
  __all__.extend([_s for _s in _names_with_underscore])
            """
  
                      content = content.replace(
                          "# __all__ PLACEHOLDER", root_module_footer
                      )
  
                      content = content.replace(
                          "# WRAPPER_PLACEHOLDER",
                          _get_module_wrapper(
                              module,
                              output_dir,
                              output_package,
                              api_version,
                              symbols_by_module,
                              use_lazy_loading,
                          ),
                      )
  
                      f.write(content)
                      continue
  
              f.write(
                  _GENERATED_FILE_HEADER
                  % _get_module_docstring(docs_by_module, module)
              )
  
              f.write(module_imports)
  
              f.write(
                  _get_module_wrapper(
                      module,
                      output_dir,
                      output_package,
                      api_version,
                      symbols_by_module,
                      use_lazy_loading,
                  )
              )
  
imports: import collections
  from collections.abc import Mapping, Sequence, Set
  import dataclasses
  import os
  from typing import Optional
  from absl import app
  from absl import flags
  from tensorflow.python.tools.api.generator2.shared import exported_api
label_desc: Use image node_id 10 for calling a global function with example usage: _gen_init_files(output_dir, output_package, api_version, symbols_by_module, generated_imports_by_module, docs_by_module, root_template_path, file_prefixes_to_strip, use_lazy_loading, module_prefix, output_files, subpackage_rewrite, root_file_name) without return types