<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def read_metadata_by_name(self, name, metadata_key, caster=None):
 """Read process metadata using a named identity. :param string name: The ProcessMetadataManager identity/name (e.g. 'pantsd'). :param string metadata_key: The metadata key (e.g. 'pid'). :param func caster: A casting callable to apply to the read value (e.g. `int`). """

    file_path = self._metadata_file_path(name, metadata_key)
    try:
      metadata = read_file(file_path).strip()
      return self._maybe_cast(metadata, caster)
    except (IOError, OSError):
      return None