def escape_invalid_characters(name, invalid_char_list, replace_with='_'):
 for char in invalid_char_list:
  if (char in name):
   name = name.replace(char, replace_with)
 return name

def escape_invalid_characters ( name , invalid_char_list , replace_with = '_' ) : for char in invalid_char_list : if ( char in name ) : name = name . replace ( char , replace_with ) return name
remove invalid characters from a variable and replace it with given character .