import re


def sanitize_name(name):
    """ Sanitize a name to something that twitter allows. """

    sanitized_name = '-'.join(
        filter(None, re.sub("[^a-z0-9_-]+", '-', name.lower()).split('-'))
    )

    return sanitized_name[:25]