code: def slug(text, separator="_", permitted_chars=SLUG_CHARS):
      
  
      text = six.text_type(text or "")
  
      # Strip non-ASCII characters
      # Example: u' ÁLVARO  justen% ' -> ' ALVARO  justen% '
      text = normalize("NFKD", text.strip()).encode("ascii", "ignore").decode("ascii")
  
      # Replace word boundaries with separator
      text = REGEXP_WORD_BOUNDARY.sub("\\1" + re.escape(separator), text)
  
      # Remove non-permitted characters and put everything to lowercase
      # Example: u'_ALVARO__justen%_' -> u'_alvaro__justen_'
      allowed_chars = list(permitted_chars) + [separator]
      text = "".join(char for char in text if char in allowed_chars).lower()
  
      # Remove double occurrencies of separator
      # Example: u'_alvaro__justen_' -> u'_alvaro_justen_'
      text = (
          REGEXP_SEPARATOR
          if separator == "_"
          else re.compile("(" + re.escape(separator) + "+)")
      ).sub(separator, text)
  
      # Strip separators
      # Example: u'_alvaro_justen_' -> u'alvaro_justen'
      return text.strip(separator)
docs: Generate a slug for the `text`.
  
      >>> slug(' ÁLVARO  justen% ')
      'alvaro_justen'
      >>> slug(' ÁLVARO  justen% ', separator='-')
      'alvaro-justen'