import re


def clean_name(name: str) -> str:
    """
    Clean a name so it can be used as a python identifier.
    """
    if not re.match("[a-zA-Z_]", name[0]):
        name = "_" + name
    name = re.sub("[^0-9a-zA-Z_]+", "_", name)
    if all(c == "_" for c in name):
        name = "v"
    return name