def GetFileObject(self, data_stream_name=''):
    """Retrieves the file-like object.

    Args:
      data_stream_name (Optional[str]): name of the data stream, where an empty
          string represents the default data stream.

    Returns:
      FakeFileIO: a file-like object or None if not available.

    Raises:
      IOError: if the file entry is not a file.
      OSError: if the file entry is not a file.
    """
    if not self.IsFile():
      raise IOError('Cannot open non-file.')

    if data_stream_name:
      return None

    location = getattr(self.path_spec, 'location', None)
    if location is None:
      return None

    file_data = self._file_system.GetDataByPath(location)
    file_object = fake_file_io.FakeFile(self._resolver_context, file_data)
    file_object.open(path_spec=self.path_spec)
    return file_object