          detail = get_error_detail(exc)
      else:
          detail = exc.detail
  
      if isinstance(detail, dict):
          # If errors may be a dict we use the standard {key: list of values}.
          # Here we ensure that all the values are *lists* of errors.
          return {
              key: value if isinstance(value, (list, dict)) else [value]
              for key, value in detail.items()
 
</s> remove             key: value if isinstance(value, (list, dict)) else [value]
 </s> add             key: value if isinstance(value, (list, Mapping)) else [value] </s> remove         if not isinstance(data, dict):
 </s> add         if not isinstance(data, Mapping): </s> remove from collections import OrderedDict
 </s> add from collections import Mapping, OrderedDict
    if isinstance(detail, Mapping):
          detail = get_error_detail(exc)
      else:
          detail = exc.detail
  
    if isinstance(detail, Mapping):
          # If errors may be a dict we use the standard {key: list of values}.
          # Here we ensure that all the values are *lists* of errors.
          return {
              key: value if isinstance(value, (list, dict)) else [value]
              for key, value in detail.items()
keep keep keep keep replace keep keep keep keep keep
 Check for collection.Mapping instead of dict

issue #4901 
rest_framework/serializers.py