old_contents: from django.http import JsonResponse
  
  
  class ApiBase(object):
  
      STATUS_ERROR = 0
      STATUS_SUCCESS = 1
      STATUS_WARNING = 2
  
      def json_response(self, data=None, status=STATUS_SUCCESS, message=None):
  
          status_code = 400 if status == ApiBase.STATUS_ERROR else 200
  
          return JsonResponse({
              "data": data,
              "status": status,
              "message": message
          }, status=status_code)
  
new_contents: from django.http import JsonResponse
  
  
  class ApiBase(object):
      @classmethod
      def success(cls, data, status=200):
          """
          :type data: dict
          :type status: int
          :rtype JsonResponse
  
          """
          return JsonResponse(data, status=status)
  
      @classmethod
      def error(cls, error, status=400):
          """
          :type error: str
          :type status: int
          :rtype JsonResponse
  
          """
          return JsonResponse({'error': error}, status=status)
  
subject: Refactor json_response to more BDD methods