def choices_validator(choices):
    """Return validator function that will check if ``value in choices``.

    Args:
        max_value (list, set, tuple): allowed choices for new validator

    """
    def validator(value):
        if value not in choices:
            # note: make it a list for consistent representation
            raise ValidationError(
                "{} is not in {}".format(value, list(choices))
            )

    return validator
Return validator function that will check if ``value in choices``.

    Args:
        max_value (list, set, tuple): allowed choices for new validator