def error_response(response, message, status_code=400):
 log.debug(message)
 response['status'] = message
 return JsonResponse(response, status_code)

def error_response ( response , message , status_code = 400 ) : log . debug ( message ) response [ 'status' ] = message return JsonResponse ( response , status_code )
simplify similar actions: log message and return jsonresponse with message included in response .