code: def write(self, label, index):
          
          if label in self.cache:
              if self.cache[label] != index:
                  error_message = 'cache_conflict on label: {} with index: {}\ncache dump: {}'.format(label, index, self.cache)
                  raise RuntimeError(error_message)
          else:
              self.cache[label] = index
docs: Saves a new label, index mapping to the cache.
          Raises a RuntimeError on a conflict.