code: def _make_mmap_tarball(tarballs_root: str, mmap_cache_size: int):
      @lru_cache(maxsize=mmap_cache_size)
      def _mmap_tarball(class_id: str) -> mmap:
          tarball_path = _get_tarball_path(class_id)
          tarball_full_path = os.path.join(tarballs_root, tarball_path)
          with open(tarball_full_path) as f:
              return mmap(
                  fileno=f.fileno(), length=0, access=ACCESS_READ
              )
  
      return _mmap_tarball
  
imports: from dataclasses import dataclass
  from enum import Enum
  from functools import lru_cache
  from gzip import GzipFile
  from io import BytesIO
  from mmap import ACCESS_READ, mmap
  import os
  from typing import Any, Callable, List, Optional, Set, Tuple
  import warnings
  import numpy
  from .extended import ExtendedVisionDataset
label_desc: Use image node_id 2 for calling a global function with example usage: _make_mmap_tarball(tarballs_root, mmap_cache_size) and returns: _mmap_tarball, mmap