def sanitize_param(value, valid_characters=valid_chars, character_map=mapped_chars, invalid_character='X'):
 if isinstance(value, string_types):
  return sanitize_text(value, valid_characters=valid_characters, character_map=character_map, invalid_character=invalid_character)
 elif isinstance(value, list):
  return [sanitize_text(x, valid_characters=valid_characters, character_map=character_map, invalid_character=invalid_character) for x in value]
 else:
  raise Exception(('Unknown parameter type (%s)' % type(value)))

def sanitize_param ( value , valid_characters = valid_chars , character_map = mapped_chars , invalid_character = 'X' ) : if isinstance ( value , string_types ) : return sanitize_text ( value , valid_characters = valid_characters , character_map = character_map , invalid_character = invalid_character ) elif isinstance ( value , list ) : return [ sanitize_text ( x , valid_characters = valid_characters , character_map = character_map , invalid_character = invalid_character ) for x in value ] else : raise Exception ( ( 'Unknown parameter type (%s)' % type ( value ) ) )
clean incoming parameters .