import unicodedata


def remove_accents(text):
    """
    Remove accents from a string
    """
    try:
        text = text.decode("utf-8")
    except (UnicodeEncodeError, AttributeError):
        pass
    text = text.replace("’", "'")  # accent used as apostrophe
    text = unicodedata.normalize("NFKD", text).encode("ascii", "ignore")
    text = text.decode()
    return text