import re


def sanitise(name):
    """Convert name into a valid identifier.
    """
    res = re.sub(r"\[(\d+)]$", r"_\1", name)
    res = re.sub(r"\W+", r"_", res)
    res = re.sub(r"^(\d)", r"_\1", res)
    return "o." + res