def do_title(s):
 rv = []
 for item in re.compile('([-\\s]+)(?u)').split(s):
  if (not item):
   continue
  rv.append((item[0].upper() + item[1:].lower()))
 return ''.join(rv)

def do_title ( s ) : rv = [ ] for item in re . compile ( '([-\\s]+)(?u)' ) . split ( s ) : if ( not item ) : continue rv . append ( ( item [ 0 ] . upper ( ) + item [ 1 : ] . lower ( ) ) ) return '' . join ( rv )
return a titlecased version of the value .