def slug(value):
    if value is None:
        raise vol.Invalid('Slug should not be None')
    value = str(value)
    slg = slugify(value)
    if value == slg:
        return value
    raise vol.Invalid('invalid slug {} (try {})'.format(value, slg))
Validate value is a valid slug.
dataset/ETHPy150Open home-assistant/home-assistant/homeassistant/helpers/config_validation.py/slug