code: def _api_convert_output(return_value):
      
      content_type = web.ctx.environ.get('CONTENT_TYPE', 'text/json')
  
      if "text/json" in content_type:
          web.header('Content-Type', 'text/json; charset=utf-8')
          return json.dumps(return_value)
      if "text/html" in content_type:
          web.header('Content-Type', 'text/html; charset=utf-8')
          dump = yaml.dump(return_value)
          return "<pre>" + web.websafe(dump) + "</pre>"
      if "text/yaml" in content_type or \
                      "text/x-yaml" in content_type or \
                      "application/yaml" in content_type or \
                      "application/x-yaml" in content_type:
          web.header('Content-Type', 'text/yaml; charset=utf-8')
          dump = yaml.dump(return_value)
          return dump
      web.header('Content-Type', 'text/json; charset=utf-8')
      return json.dumps(return_value)
docs: Convert the output to what the client asks