'Actually write the file contents to disk. This helps with mocking.'

@staticmethod
def _write(filename, contents):

    tmp_filename = (filename + '.yedit')
    with open(tmp_filename, 'w') as yfd:
        yfd.write(contents)
    os.rename(tmp_filename, filename)
