Python flexible slugify function