Certifier for enum values.

    :param value:
        The value to be certified.
    :param kind:
        The enum type that value should be an instance of.
    :param bool required:
        Whether the value can be `None`. Defaults to True.
    :raises CertifierValueError:
        The type is invalid

def certify_enum_value(value, kind=None, required=True):
    """
    Certifier for enum values.

    :param value:
        The value to be certified.
    :param kind:
        The enum type that value should be an instance of.
    :param bool required:
        Whether the value can be `None`. Defaults to True.
    :raises CertifierValueError:
        The type is invalid
    """
    if certify_required(
        value=value,
        required=required,
    ):
        return

    try:
        kind(value)
    except:  # noqa
        raise CertifierValueError(
            message="value {value!r} is not a valid member of {enum!r}".format(
                value=value, enum=kind.__name__),
            value=value,
            required=required,
        )