def slugize(slug):
 assert (name_pattern.match(slug) is not None)
 slug = slug.lower()
 for c in (' ', ',', '.', '_'):
  slug = slug.replace(c, '-')
 while ('--' in slug):
  slug = slug.replace('--', '-')
 slug = slug.strip('-')
 return slug

def slugize ( slug ) : assert ( name_pattern . match ( slug ) is not None ) slug = slug . lower ( ) for c in ( ' ' , ',' , '.' , '_' ) : slug = slug . replace ( c , '-' ) while ( '--' in slug ) : slug = slug . replace ( '--' , '-' ) slug = slug . strip ( '-' ) return slug
create a slug from a team name .