<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def await_metadata_by_name(self, name, metadata_key, timeout, caster=None):
 """Block up to a timeout for process metadata to arrive on disk. :param string name: The ProcessMetadataManager identity/name (e.g. 'pantsd'). :param string metadata_key: The metadata key (e.g. 'pid'). :param int timeout: The deadline to write metadata. :param type caster: A type-casting callable to apply to the read value (e.g. int, str). :returns: The value of the metadata key (read from disk post-write). :raises: :class:`ProcessMetadataManager.Timeout` on timeout. """

    file_path = self._metadata_file_path(name, metadata_key)
    self._wait_for_file(file_path, timeout=timeout)
    return self.read_metadata_by_name(name, metadata_key, caster)