def validate_fingerprint_if_present(instance, _attribute, value):
    """Validate that the private key matches the fingerprint pin.

    :raises ValueError: if the fingerprint pin is present \\
                        but doesn't match the private key
    """
    if not value:
        return
    if instance.private_key.matches_fingerprint(value):
        return
    raise ValueError(
        f'The private key provided (with a fingerprint of {instance.private_key.fingerprint!s}) does not match the pinned fingerprint value of {value!s}'
        )
