def _format_return_as_json(rval, jsonp_callback=None, pretty=False):
 dumps_kwargs = (dict(indent=4, sort_keys=True) if pretty else {})
 json = safe_dumps(rval, **dumps_kwargs)
 if jsonp_callback:
  json = '{}({});'.format(jsonp_callback, json)
 return json

def _format_return_as_json ( rval , jsonp_callback = None , pretty = False ) : dumps_kwargs = ( dict ( indent = 4 , sort_keys = True ) if pretty else { } ) json = safe_dumps ( rval , ** dumps_kwargs ) if jsonp_callback : json = '{}({});' . format ( jsonp_callback , json ) return json
formats a return value as json or jsonp if jsonp_callback is present .