def _validate_subset(of, allow_none=False):
    """
    Create validator to check that an attribute is a subset of ``of``.

    Parameters
    ----------
    of: str
        Attribute name that the subject under validation should be a subset of.

    Returns
    -------
    validator: Callable
        Validator that can be used for ``attr.ib``.
    """

    def _v(instance, attribute, value):
        if allow_none and value is None:
            return
        other_set = set(getattr(instance, of))
        if isinstance(value, str):
            my_set = {value}
        else:
            my_set = set(value)
        too_much = my_set - other_set

        if too_much:
            raise ValueError(
                "{attribute} must be a subset of {of}, but it has additional values: {too_much}".format(
                    attribute=attribute.name,
                    of=of,
                    too_much=", ".join(sorted(too_much)),
                )
            )

    return _v