def METHOD_NAME(self, key: str, value: str, replacement: str):
    """
    Replace the value `value` with `replacement` for the tag `key`
    """
    values = self.paths_by_tags[key]
    if value in values:
        values[replacement].update(values.pop(value))
    for tags in self.tags_by_paths.values():
        if key in tags:
            if tags[key] == value:
                tags[key] = replacement