def safe_extra(extra):
 return re.sub('[^A-Za-z0-9.-]+', '_', extra).lower()

def safe_extra ( extra ) : return re . sub ( '[^A-Za-z0-9.-]+' , '_' , extra ) . lower ( )
convert an arbitrary string to a standard extra name any runs of non-alphanumeric characters are replaced with a single _ .