def slugify(title): """Lowercase ASCII slug: words joined by single hyphens, no leading or trailing hyphen.""" import re slug = title.lower() slug = re.sub(r"[^a-z0-9]", "-", slug) return slug