def _is_valid_slug(slug):
 VALID_SLUG_RE = re.compile('^[a-z0-9\\-]+$')
 return VALID_SLUG_RE.match(slug)

def _is_valid_slug ( slug ) : VALID_SLUG_RE = re . compile ( '^[a-z0-9\\-]+$' ) return VALID_SLUG_RE . match ( slug )
returns true if slug is valid .