def write_metadata(self, metadata):
        """
        Write a block of metadata to an object.
        """
        data, cur_mdata = self._filesystem.get_object(self._name)
        if data is not None:
            # The object exists. Update the new metadata with the object's
            # immutable metadata (e.g. name, size, etag, sysmeta) and store it
            # with the object data.
            immutable_metadata = dict(
                [(key, val) for key, val in cur_mdata.items()
                 if key.lower() in DATAFILE_SYSTEM_META
                 or is_sys_meta('object', key)])
            metadata.update(immutable_metadata)
            metadata['name'] = self._name
            self._filesystem.put_object(self._name, data, metadata)
dataset/ETHPy150Open openstack/swift/swift/obj/mem_diskfile.py/DiskFile.write_metadata/original