def SlugCheck(slug, allow=''):
 if (not (slug == CleanText(unicode(slug), banned=CleanText.NONDNS.replace(allow, '')).clean)):
  raise ValueError((_('Invalid URL slug: %s') % slug))
 return slug.lower()

def SlugCheck ( slug , allow = '' ) : if ( not ( slug == CleanText ( unicode ( slug ) , banned = CleanText . NONDNS . replace ( allow , '' ) ) . clean ) ) : raise ValueError ( ( _ ( 'Invalid URL slug: %s' ) % slug ) ) return slug . lower ( )
verify that a string is a valid url slug .