import json
from flask import Response


def build_response(output, status=200, mimetype='application/json',
                   headers={}):
    return Response(
        json.dumps(output),
        mimetype=mimetype
    ), status, headers

import json
from flask import Response, jsonify


def build_response(output, status=200, mimetype='application/json',
                   headers={}):
    resp = jsonify(output)
    resp.mimetype = mimetype
    return resp, status, headers

Fix issue with datetime handling
Fix issue with datetime handling

  import json
- from flask import Response
+ from flask import Response, jsonify
  
  
  def build_response(output, status=200, mimetype='application/json',
                     headers={}):
+     resp = jsonify(output)
-     return Response(
-         json.dumps(output),
-         mimetype=mimetype
+     resp.mimetype = mimetype
-     ), status, headers
+     return resp, status, headers
  
Fix issue with datetime handling
## Code Before:
import json
from flask import Response


def build_response(output, status=200, mimetype='application/json',
                   headers={}):
    return Response(
        json.dumps(output),
        mimetype=mimetype
    ), status, headers

## Instruction:
Fix issue with datetime handling
## Code After:
import json
from flask import Response, jsonify


def build_response(output, status=200, mimetype='application/json',
                   headers={}):
    resp = jsonify(output)
    resp.mimetype = mimetype
    return resp, status, headers
