def wikipedia_slugify(value, do_unidecode=False):
    """
    Converts to ASCII via unidecode.
    Converts spaces to underscore.

    Removes characters that
    aren't alphanumerics, underscores, or hyphens.

    Preserve case.

    Also strips leading and trailing whitespace.
    """
    if do_unidecode:
        value = unidecode(value)
    value = value.strip()
    return mark_safe(re.sub('[\s/#\?:@]+', '_', value))