code: def Open(self, path_spec, mode='rb'):
      
      if self._is_open and not self._is_cached:
        raise IOError('Already open.')
  
      if mode != 'rb':
        raise ValueError('Unsupported mode: {0:s}.'.format(mode))
  
      if not path_spec:
        raise ValueError('Missing path specification.')
  
      if not self._is_open:
        self._Open(path_spec, mode=mode)
        self._is_open = True
        self._path_spec = path_spec
  
        if path_spec and not self._resolver_context.GetFileSystem(path_spec):
          self._resolver_context.CacheFileSystem(path_spec, self)
          self._is_cached = True
  
      if self._is_cached:
        self._resolver_context.GrabFileSystem(path_spec)
docs: Opens the file system object defined by path specification.
  
      Args:
        path_spec (PathSpec): a path specification.
        mode (Optional[str]): file access mode. The default is 'rb' which
            represents read-only binary.
  
      Raises:
        AccessError: if the access to open the file was denied.
        IOError: if the file system object was already opened or the open failed.
        OSError: if the file system object was already opened or the open failed.
        PathSpecError: if the path specification is incorrect.
        ValueError: if the path specification or mode is invalid.