def wiki_escape(s):
 ret = []
 for word in s.split():
  if re.match('[A-Z]+[a-z]+[A-Z]', word):
   word = ('!%s' % word)
  ret.append(word)
 return ' '.join(ret)

def wiki_escape ( s ) : ret = [ ] for word in s . split ( ) : if re . match ( '[A-Z]+[a-z]+[A-Z]' , word ) : word = ( '!%s' % word ) ret . append ( word ) return ' ' . join ( ret )
detect wikisyntax and escape it .