def _get_target_root(state: BeaconState, config: Eth2Config, beacon_block_root: Hash32) -> Hash32:
    epoch = compute_epoch_of_slot(state.slot, config.SLOTS_PER_EPOCH)
    epoch_start_slot = compute_start_slot_of_epoch(epoch, config.SLOTS_PER_EPOCH)
    if (epoch_start_slot == state.slot):
        return beacon_block_root
    else:
        return get_block_root(state, epoch, config.SLOTS_PER_EPOCH, config.SLOTS_PER_HISTORICAL_ROOT)
def _get_target_root(state: BeaconState, config: Eth2Config, beacon_block_root: Hash32) -> Hash32:
    epoch = compute_epoch_of_slot(state.slot, config.SLOTS_PER_EPOCH)
    epoch_start_slot = compute_start_slot_of_epoch(epoch, config.SLOTS_PER_EPOCH)
    if (epoch_start_slot == state.slot):
        return beacon_block_root
    else:
        return get_block_root(state, epoch, config.SLOTS_PER_EPOCH, config.SLOTS_PER_HISTORICAL_ROOT)