code: def slugify(in_string):
      
      try:
          u_in_string = six.text_type(in_string).lower()
      except UnicodeDecodeError:
          raise ValueError("We expects when in_string is str type," + \
                           "it is an ascii, but now it isn't. Use unicode " + \
                           "in this case.")
      # convert & to "and"
      u_in_string = re.sub('\&amp\;|\&', ' and ', u_in_string)
      # replace spaces by hyphen
      u_in_string = re.sub('[-\s]+', '-', u_in_string)
      # remove symbols that not in alphabet
      u_in_string = u''.join([symb for symb in u_in_string if symb in ALPHABET])
      # translify it
      out_string = translify(u_in_string)
      # remove non-alpha
      return re.sub('[^\w\s-]', '', out_string).strip().lower()
docs: Prepare string for slug (i.e. URL or file/dir name)
  
      @param in_string: input string
      @type in_string: C{basestring}
  
      @return: slug-string
      @rtype: C{str}
  
      @raise ValueError: if in_string is C{str}, but it isn't ascii