<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _get_metadata(self, key):
 """ If the server returned a metadata dictionary, retrieve a particular key from it. If no metadata exists, or the key does not exist, return None. :param key: Metadata key, e.g., "gate_depth" :return: The associated metadata. :rtype: Optional[Any] """

        if not self.is_done():
            raise ValueError("Cannot get metadata for a program that isn't completed.")

        return self._raw.get("metadata", {}).get(key, None)