code: def _build_memmap_index_files(
      newline_int, build_index_fn, fn, index_mapping_dir: str
  ):
      """Helper function to build an index file"""
      idx_fn = _index_fn(fn, index_mapping_dir)
  
      # create data map
      if _index_file_exists(idx_fn):
          return False
      else:
          logging.info(f"Building indexing for fn = {fn}")
          # find all newline positions
          midx = build_index_fn(fn, newline_int)
          # validate midx
          midx = np.asarray(midx)
          if not np.issubdtype(midx.dtype, np.integer):
              raise TypeError(
                  f"midx must be an integer array, but got type = {midx.dtype}"
              )
  
          # create e metadata file
          data = dict(newline_int=newline_int, version=__idx_version__)
  
          # save index as numpy array to enable memmap reading
          logging.info(f"Saving idx file = {idx_fn}.npy")
          np.save(idx_fn + ".npy", midx, allow_pickle=True)
          logging.info(f"Saving metadata file = {idx_fn}.info")
          pickle.dump(data, open(idx_fn + ".info", "wb"))
  
          return True
  
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 4 for calling a global function with example usage: _build_memmap_index_files(newline_int, build_index_fn, fn, index_mapping_dir) and returns: False, True