def GetDataStreamByPathSpec(self, path_spec):
    """Retrieves a data stream for a path specification.

    Args:
      path_spec (PathSpec): a path specification.

    Returns:
      DataStream: a data stream or None if not available.
    """
    file_entry = self.GetFileEntryByPathSpec(path_spec)
    if not file_entry:
      return None

    data_stream_name = getattr(path_spec, 'data_stream', None)
    return file_entry.GetDataStream(data_stream_name)