This method updates the find query filter spec used to read the segment for a version.
    It chooses whether to query via forward pointers or not based on the version details and current mode of operation.

def _spec_fw_pointers_aware(symbol, version, from_index=None, to_index=None):
    """
    This method updates the find query filter spec used to read the segment for a version.
    It chooses whether to query via forward pointers or not based on the version details and current mode of operation.
    """
    spec = {'symbol': symbol,
            'segment': {'$lt': version['up_to'] if to_index is None else to_index}}
    if from_index is not None:
        spec['segment']['$gte'] = from_index

    # Version was written with an older arctic, not FW-pointers aware, or written with FW pointers disabled
    if FW_POINTERS_CONFIG_KEY not in version or version[FW_POINTERS_CONFIG_KEY] == FwPointersCfg.DISABLED.name:
        spec['parent'] = version_base_or_id(version)
        return spec

    v_fw_config = FwPointersCfg[version[FW_POINTERS_CONFIG_KEY]]

    # Version was created exclusively with fw pointers
    if v_fw_config is FwPointersCfg.ENABLED:
        if from_index is None and to_index is None:
            del spec['segment']
        spec['sha'] = {'$in': version[FW_POINTERS_REFS_KEY]}
        return spec

    # Version was created both with fw and legacy pointers, choose based on module configuration
    if v_fw_config is FwPointersCfg.HYBRID:
        if ARCTIC_FORWARD_POINTERS_CFG is FwPointersCfg.DISABLED:
            spec['parent'] = version_base_or_id(version)
        else:
            if from_index is None and to_index is None:
                del spec['segment']
            spec['sha'] = {'$in': version[FW_POINTERS_REFS_KEY]}
        return spec

    # The code below shouldn't really be reached.
    raise DataIntegrityException("Unhandled FW pointers configuration ({}: {}/{}/{})".format(
        version.get('symbol'), version.get('_id'), version.get('version'), v_fw_config))