code: def test_local_level_cache(self):
      num_successful_fetches = [0]
      num_failed_fetches = [0]
      num_writes = [0]
  
      class LevelCache(object):
          def __init__(self, cache_dir):
              self._cache_dir = cache_dir
  
          def fetch(self, key, pk3_path):
              path = os.path.join(self._cache_dir, key)
              if os.path.isfile(path):
                  shutil.copyfile(path, pk3_path)
                  num_successful_fetches[0] += 1
                  return True
              num_failed_fetches[0] += 1
              return False
  
          def write(self, key, pk3_path):
              path = os.path.join(self._cache_dir, key)
              num_writes[0] += 1
              shutil.copyfile(pk3_path, path)
  
      env = self._create_environment(
          LevelCache(cache_dir=self._test_dir)
      )
      env.reset(episode=1, seed=123)
      env.step(self._dummy_action)
  
      self.assertEqual(0, num_successful_fetches[0])
      self.assertEqual(1, num_failed_fetches[0])
      self.assertEqual(1, num_writes[0])
  
      env.reset(episode=1, seed=123)
      env.step(self._dummy_action)
  
      self.assertEqual(1, num_successful_fetches[0])
      self.assertEqual(1, num_failed_fetches[0])
      self.assertEqual(1, num_writes[0])
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  import shutil
  import six
  import tempfile
  from absl.testing import absltest
  import numpy
  import deepmind_lab
label_desc: Use image node_id 9 for calling the LevelCacheTest obj's underlying member method code with example usage: obj.test_local_level_cache() and returns: False, True