text: from rest_framework.views import exception_handler
  
  
  def core_exception_handler(exc, context):
      # Delegate error handling
      res = exception_handler(exc, context)
      handlers = {
          'ValidationError': _handle_generic_error
      }
  
      # Identifier for current exception
      exception_class = exc.__class__.__name__
  
      # If the exception_class matches ValidationError, generate error response
      if exception_class in handlers:
          return handlers[exception_class](exc, context, res)
  
      return res
  
  
  def _handle_generic_error(exc, context, res):
      # Take response generated by DRF and wrap it in errors key
      res.data = {
          'errors': res.data
      }
  
      return res
  