  import math
  
  from django.utils import six
  from django.utils.encoding import force_text
  from django.utils.translation import ugettext_lazy as _
  from django.utils.translation import ungettext
  
  from rest_framework import status
 
</s> remove     APIException, ErrorDetail, Throttled, _get_error_details
 </s> add     APIException, ErrorDetail, Throttled, _get_error_details, bad_request,
    server_error </s> remove from django.test import TestCase
 </s> add from django.test import RequestFactory, TestCase
from django.http import JsonResponse
  import math
  
from django.http import JsonResponse
  from django.utils import six
  from django.utils.encoding import force_text
  from django.utils.translation import ugettext_lazy as _
  from django.utils.translation import ungettext
  
  from rest_framework import status
keep add keep keep keep keep keep keep
 Added generic 500 and 400 JSON error handlers. (#5904)

* Added generic 500 and 400 JSON error handlers.
* Docs for generic error views. 
rest_framework/exceptions.py