def substitute_category_name(category_name):
 return re.sub('\\s', '_', category_name).replace('-', '_').lower()

def substitute_category_name ( category_name ) : return re . sub ( '\\s' , '_' , category_name ) . replace ( '-' , '_' ) . lower ( )
replaces whitespace and - characters in category_name to allow category_name to be made into a valid python identifier .