'Modify `filename`, reading its contents and replacing the strings
specified in `self.replacements`.'

def replace_contents(self, filename, log):

    with codecs.open(filename, 'r', encoding='utf-8') as f:
        contents = f.read()
    for (old, new_) in self.replacements.items():
        contents = contents.replace(old, new_)
    with codecs.open(filename, 'w', encoding='utf-8') as f:
        f.write(contents)
