def _json_format_dict(data, pretty=False):
 if pretty:
  return json.dumps(data, sort_keys=True, indent=2)
 else:
  return json.dumps(data)

def _json_format_dict ( data , pretty = False ) : if pretty : return json . dumps ( data , sort_keys = True , indent = 2 ) else : return json . dumps ( data )
serialize data to a json formated str .