def typecast_string(s):
 if ((not s) and (not isinstance(s, str))):
  return s
 return smart_unicode(s)

def typecast_string ( s ) : if ( ( not s ) and ( not isinstance ( s , str ) ) ) : return s return smart_unicode ( s )
cast all returned strings to unicode strings .