# standard imports import json DEFAULT_HEADERS = [ ('Access-Control-Allow-Origin', '*'), ('Content-Type', 'application/json'), ] def respond(start_response, data): json_data = json.dumps(data) content = json_data.encode('utf-8') headers = [ *DEFAULT_HEADERS, ('Content-Type', 'application/json',) ] start_response('200 OK', headers) return [content]