<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set_metadata(self, key, metadata):
 """ Store the metadata for the given instance key. """

        with self._lock:
            self._metadata[key] = metadata