code: def _GetAPFSVolumeIdentifiers(self, scan_node):
      
      if not scan_node or not scan_node.path_spec:
        raise errors.SourceScannerError('Invalid scan node.')
  
      volume_system = apfs_volume_system.APFSVolumeSystem()
      volume_system.Open(scan_node.path_spec)
  
      volume_identifiers = self._source_scanner.GetVolumeIdentifiers(
          volume_system)
      if not volume_identifiers:
        return []
  
      # TODO: refactor self._volumes to use scan options.
      if self._volumes:
        if self._volumes == 'all':
          volumes = range(1, volume_system.number_of_volumes + 1)
        else:
          volumes = self._volumes
  
        selected_volume_identifiers = self._NormalizedVolumeIdentifiers(
            volume_system, volumes, prefix='apfs')
  
        if not set(selected_volume_identifiers).difference(volume_identifiers):
          return selected_volume_identifiers
  
      if len(volume_identifiers) > 1:
        try:
          volume_identifiers = self._PromptUserForAPFSVolumeIdentifiers(
              volume_system, volume_identifiers)
        except KeyboardInterrupt:
          raise errors.UserAbort('File system scan aborted.')
  
      return self._NormalizedVolumeIdentifiers(
          volume_system, volume_identifiers, prefix='apfs')
docs: Determines the APFS volume identifiers.
  
      Args:
        scan_node (dfvfs.SourceScanNode): scan node.
  
      Returns:
        list[str]: APFS volume identifiers.
  
      Raises:
        SourceScannerError: if the format of or within the source is not
            supported or the the scan node is invalid.
        UserAbort: if the user requested to abort.