def encrypt_ballot(ballot: PlaintextBallot, internal_manifest: InternalManifest, context: CiphertextElectionContext, encryption_seed: ElementModQ, nonce: Optional[ElementModQ]=None, should_verify_proofs: bool=True) -> Optional[CiphertextBallot]:
    "\n    Encrypt a specific `Ballot` in the context of a specific `CiphertextElectionContext`.\n\n    This method accepts a ballot representation that only includes `True` selections.\n    It will fill missing selections for a contest with `False` values, and generate `placeholder`\n    selections to represent the number of seats available for a given contest.\n\n    This method also allows for ballots to exclude passing contests for which the voter made no selections.\n    It will fill missing contests with `False` selections and generate `placeholder` selections that are marked `True`.\n\n    :param ballot: the ballot in the valid input form\n    :param internal_manifest: the `InternalManifest` which defines this ballot's structure\n    :param context: all the cryptographic context for the election\n    :param encryption_seed: Hash from previous ballot or starting hash from device\n    :param nonce: an optional `int` used to seed the `Nonce` generated for this contest\n                 if this value is not provided, the secret generating mechanism of the OS provides its own\n    :param should_verify_proofs: specify if the proofs should be verified prior to returning (default True)\n    "
    style = internal_manifest.get_ballot_style(ballot.style_id)
    if (not ballot.is_valid(style.object_id)):
        log_warning(f'malformed input ballot: {ballot}')
        return None
    random_master_nonce = get_or_else_optional_func(nonce, (lambda : rand_q()))
    nonce_seed = CiphertextBallot.nonce_seed(internal_manifest.manifest_hash, ballot.object_id, random_master_nonce)
    log_info(f': manifest_hash : {internal_manifest.manifest_hash.to_hex()}')
    log_info(f': encryption_seed : {encryption_seed.to_hex()}')
    encrypted_contests = encrypt_ballot_contests(ballot, internal_manifest, context, nonce_seed)
    if (encrypted_contests is None):
        return None
    encrypted_ballot = make_ciphertext_ballot(ballot.object_id, ballot.style_id, internal_manifest.manifest_hash, encryption_seed, encrypted_contests, random_master_nonce)
    if (not encrypted_ballot.code):
        return None
    if (not should_verify_proofs):
        return encrypted_ballot
    if encrypted_ballot.is_valid_encryption(internal_manifest.manifest_hash, context.elgamal_public_key, context.crypto_extended_base_hash):
        return encrypted_ballot
    return None
Encrypt a specific `Ballot` in the context of a specific `CiphertextElectionContext`.

This method accepts a ballot representation that only includes `True` selections.
It will fill missing selections for a contest with `False` values, and generate `placeholder`
selections to represent the number of seats available for a given contest.

This method also allows for ballots to exclude passing contests for which the voter made no selections.
It will fill missing contests with `False` selections and generate `placeholder` selections that are marked `True`.

:param ballot: the ballot in the valid input form
:param internal_manifest: the `InternalManifest` which defines this ballot's structure
:param context: all the cryptographic context for the election
:param encryption_seed: Hash from previous ballot or starting hash from device
:param nonce: an optional `int` used to seed the `Nonce` generated for this contest
             if this value is not provided, the secret generating mechanism of the OS provides its own
:param should_verify_proofs: specify if the proofs should be verified prior to returning (default True)
def encrypt_ballot(ballot: PlaintextBallot, internal_manifest: InternalManifest, context: CiphertextElectionContext, encryption_seed: ElementModQ, nonce: Optional[ElementModQ]=None, should_verify_proofs: bool=True) -> Optional[CiphertextBallot]:
    "\n    Encrypt a specific `Ballot` in the context of a specific `CiphertextElectionContext`.\n\n    This method accepts a ballot representation that only includes `True` selections.\n    It will fill missing selections for a contest with `False` values, and generate `placeholder`\n    selections to represent the number of seats available for a given contest.\n\n    This method also allows for ballots to exclude passing contests for which the voter made no selections.\n    It will fill missing contests with `False` selections and generate `placeholder` selections that are marked `True`.\n\n    :param ballot: the ballot in the valid input form\n    :param internal_manifest: the `InternalManifest` which defines this ballot's structure\n    :param context: all the cryptographic context for the election\n    :param encryption_seed: Hash from previous ballot or starting hash from device\n    :param nonce: an optional `int` used to seed the `Nonce` generated for this contest\n                 if this value is not provided, the secret generating mechanism of the OS provides its own\n    :param should_verify_proofs: specify if the proofs should be verified prior to returning (default True)\n    "
    style = internal_manifest.get_ballot_style(ballot.style_id)
    if (not ballot.is_valid(style.object_id)):
        log_warning(f'malformed input ballot: {ballot}')
        return None
    random_master_nonce = get_or_else_optional_func(nonce, (lambda : rand_q()))
    nonce_seed = CiphertextBallot.nonce_seed(internal_manifest.manifest_hash, ballot.object_id, random_master_nonce)
    log_info(f': manifest_hash : {internal_manifest.manifest_hash.to_hex()}')
    log_info(f': encryption_seed : {encryption_seed.to_hex()}')
    encrypted_contests = encrypt_ballot_contests(ballot, internal_manifest, context, nonce_seed)
    if (encrypted_contests is None):
        return None
    encrypted_ballot = make_ciphertext_ballot(ballot.object_id, ballot.style_id, internal_manifest.manifest_hash, encryption_seed, encrypted_contests, random_master_nonce)
    if (not encrypted_ballot.code):
        return None
    if (not should_verify_proofs):
        return encrypted_ballot
    if encrypted_ballot.is_valid_encryption(internal_manifest.manifest_hash, context.elgamal_public_key, context.crypto_extended_base_hash):
        return encrypted_ballot
    return None