code: def _update_fw_pointers(collection, symbol, version, previous_version, is_append, shas_to_add=None):
      
      version[FW_POINTERS_CONFIG_KEY] = ARCTIC_FORWARD_POINTERS_CFG.name  # get the str as enum is not BSON serializable
  
      if ARCTIC_FORWARD_POINTERS_CFG is FwPointersCfg.DISABLED:
          return
  
      version_shas = set()
  
      if is_append:
          # Appends are tricky, as we extract the SHAs from the previous version (assuming it has FW pointers info)
          prev_fw_cfg = get_fwptr_config(previous_version)
          if prev_fw_cfg is FwPointersCfg.DISABLED.name:
              version_shas.update(Binary(sha) for sha in collection.find(
                  {'symbol': symbol,
                   'parent': version_base_or_id(previous_version),
                   'segment': {'$lt': previous_version['up_to']}},
                  {'sha': 1}))
          else:
              version_shas.update(previous_version[FW_POINTERS_REFS_KEY])
  
      # It is a write (we always get the all-inclusive set of SHAs), so no need to obtain previous SHAs
      version_shas.update(shas_to_add)
  
      # Verify here the number of seen segments vs expected ones
      if len(version_shas) != version['segment_count']:
          raise pymongo.errors.OperationFailure("Mismatched number of forward pointers to segments for {}: {} != {})"
                                                "Is append: {}. Previous version: {}. "
                                                "Gathered forward pointers segment shas: {}.".format(
              symbol, len(version_shas), version['segment_count'], is_append, previous_version['_id'], version_shas))
  
      version[FW_POINTERS_REFS_KEY] = list(version_shas)
docs: This function will decide whether to update the version document with forward pointers to segments.
      It detects cases where no prior writes/appends have been performed with FW pointers, and extracts the segment IDs.
      It also sets the metadata which indicate the mode of operation at the time of the version creation.