def create_mock_voluntary_exit(state: BeaconState, config: Eth2Config, keymap: Dict[(BLSPubkey, int)], validator_index: ValidatorIndex, exit_epoch: Epoch=None) -> VoluntaryExit:
    current_epoch = state.current_epoch(config.SLOTS_PER_EPOCH)
    target_epoch = (current_epoch if (exit_epoch is None) else exit_epoch)
    voluntary_exit = VoluntaryExit(epoch=target_epoch, validator_index=validator_index)
    return voluntary_exit.copy(signature=sign_transaction(message_hash=voluntary_exit.signing_root, privkey=keymap[state.validators[validator_index].pubkey], state=state, slot=compute_start_slot_of_epoch(target_epoch, config.SLOTS_PER_EPOCH), signature_domain=SignatureDomain.DOMAIN_VOLUNTARY_EXIT, slots_per_epoch=config.SLOTS_PER_EPOCH))
def create_mock_voluntary_exit(state: BeaconState, config: Eth2Config, keymap: Dict[(BLSPubkey, int)], validator_index: ValidatorIndex, exit_epoch: Epoch=None) -> VoluntaryExit:
    current_epoch = state.current_epoch(config.SLOTS_PER_EPOCH)
    target_epoch = (current_epoch if (exit_epoch is None) else exit_epoch)
    voluntary_exit = VoluntaryExit(epoch=target_epoch, validator_index=validator_index)
    return voluntary_exit.copy(signature=sign_transaction(message_hash=voluntary_exit.signing_root, privkey=keymap[state.validators[validator_index].pubkey], state=state, slot=compute_start_slot_of_epoch(target_epoch, config.SLOTS_PER_EPOCH), signature_domain=SignatureDomain.DOMAIN_VOLUNTARY_EXIT, slots_per_epoch=config.SLOTS_PER_EPOCH))