code: def build_index_files(
      dataset_paths,
      newline_int,
      workers=None,
      build_index_fn=_build_index_from_memdata,
      index_mapping_dir: str = None,
  ):
      """Auxiliary method to build multiple index files"""
      if len(dataset_paths) < 1:
          raise ValueError(
              "files_list must contain at leat one file name"
          )
  
      if workers is None:
          workers = max(1, os.cpu_count() // 2)
  
      logging.info(
          f"Processing {len(dataset_paths)} data files using {workers} workers"
      )
      # load all files into memmap
      start_time = time.time()
      ctx = mp.get_context("fork")
      with ctx.Pool(workers) as p:
          build_status = p.map(
              partial(
                  _build_memmap_index_files,
                  newline_int,
                  build_index_fn,
                  index_mapping_dir=index_mapping_dir,
              ),
              dataset_paths,
          )
  
      logging.info(
          f"Time building {sum(build_status)} / {len(build_status)} mem-mapped files: {datetime.timedelta(seconds=time.time() - start_time)}"
      )
  
imports: import datetime
  import json
  import multiprocessing
  import os
  import pickle
  import time
  from functools import partial
  from typing import Callable, List, Optional, Type
  import numpy
  import torch
  from nemo.core import Dataset
  from nemo.utils import AppState, logging
label_desc: Use image node_id 5 for calling a global function with example usage: build_index_files(dataset_paths, newline_int, workers, build_index_fn, index_mapping_dir) without return types