def clean_string(text):
 if isinstance(text, six.string_types):
  return text.translate(UNI_SPECIAL_CHARS).strip()
 return text.translate(None, STR_SPECIAL_CHARS).strip()

def clean_string ( text ) : if isinstance ( text , six . string_types ) : return text . translate ( UNI_SPECIAL_CHARS ) . strip ( ) return text . translate ( None , STR_SPECIAL_CHARS ) . strip ( )
remove lucene reserved characters from query string .