def METHOD_NAME(self, contents, overwrite=False, lease=None):
    if self._lease is not None:
        if not self._lease.is_valid(lease):
            raise Exception("Invalid lease!")
    if self.contents is not None or overwrite is True:
        if isinstance(contents, str):
            self.contents = contents.encode("utf8")
        elif isinstance(contents, io.BytesIO):
            self.contents = contents.read()
        elif isinstance(contents, io.StringIO):
            self.contents = contents.read().encode("utf8")
        elif isinstance(contents, bytes):
            self.contents = contents
        else:
            self.contents = contents