def _encode_basestring(s):
 if (isinstance(s, str) and (HAS_UTF8.search(s) is not None)):
  s = s.decode('utf-8')
 def replace(match):
  return ESCAPE_DCT[match.group(0)]
 return ((u'"' + ESCAPE.sub(replace, s)) + u'"')

def _encode_basestring ( s ) : if ( isinstance ( s , str ) and ( HAS_UTF8 . search ( s ) is not None ) ) : s = s . decode ( 'utf-8' ) def replace ( match ) : return ESCAPE_DCT [ match . group ( 0 ) ] return ( ( u'"' + ESCAPE . sub ( replace , s ) ) + u'"' )
return a json representation of a python string .