<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def write(self, label, index):
 """ Saves a new label, index mapping to the cache. Raises a RuntimeError on a conflict. """

        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