# shell/bash
pip install python-slugify
# or
pip3 install python-slugify
# python
from slugify import slugify
import re
def slugify(s):
s = s.lower().strip()
s = re.sub(r'[^ws-]', '', s)
s = re.sub(r'[s_-]+', '-', s)
s = re.sub(r'^-+|-+$', '', s)
return s