import re
import keyword


def sanitize(name):
    """Lower-case name and replace all non-ascii chars by `_`.
    If name is a Python keyword (like `return`) then add a trailing `_`.
    """
    new_name = re.sub(r'\W|^(?=\d)', '_', name.lower())
    if keyword.iskeyword(new_name):
        new_name = new_name + '_'
    return new_name