import unicodedata


def to_ascii(s):
    """
    Translates the string or bytes input into an ascii string with the
    accents stripped off.
    """
    if isinstance(s, bytes):
        s = s.decode('utf-8')
    return ''.join((c for c in unicodedata.normalize('NFD', s) if unicodedata.category(c) != 'Mn'))