def slugify(value, allow_unicode=False):
value = str(value)<EOL>if allow_unicode:<EOL><INDENT>value = unicodedata.normalize('<STR_LIT>', value)<EOL>value = re.sub(r'<STR_LIT>', '<STR_LIT>', value, flags=re.U).strip().lower()<EOL>return re.sub(r'<STR_LIT>', '<STR_LIT:->', value, flags=re.U)<EOL><DEDENT>else:<EOL><INDENT>value = unicodedata.normalize('<STR_LIT>', value).encode('<STR_LIT:ascii>', '<STR_LIT:ignore>').decode('<STR_LIT:ascii>')<EOL>value = re.sub(r'<STR_LIT>', '<STR_LIT>', value).strip().lower()<EOL>return re.sub('<STR_LIT>', '<STR_LIT:->', value)<EOL><DEDENT>
Normalizes string, converts to lowercase, removes non-alpha characters,
    and converts spaces to hyphens.

    :param value: string
    :param allow_unicode: allow utf8 characters
    :type allow_unicode: bool
    :return: slugified string
    :rtype: str

    :Example:
        >>> slugify('pekná líščička')
        'pekna-liscicka'