def METHOD_NAME(self, contents):
    try:
        if contents == self.read():
            return
    except OSError:
        pass
    self._perform_change(
        change.ChangeContents(self, contents), "Writing file <%s>" % self.path
    )