Store the metadata for the given instance key.

def set_metadata(self, key, metadata):
        """
        Store the metadata for the given instance key.
        """
        with self._lock:
            self._metadata[key] = metadata