  import pytest
  from django.db import models
  
  from rest_framework import exceptions, fields, relations, serializers
  from rest_framework.compat import Mapping, unicode_repr
  from rest_framework.fields import Field
  
  from .models import (
      ForeignKeyTarget, NestedForeignKeySource, NullableForeignKeySource
  )
 
</s> remove import unittest
 </s> add from collections import ChainMap </s> remove from django.utils import six
 </s> add  </s> remove from rest_framework.compat import postgres_fields, unicode_repr
 </s> add from rest_framework.compat import postgres_fields </s> remove from django.utils.six.moves.urllib import parse as urlparse
 </s> add  </s> remove from rest_framework.compat import Mapping, postgres_fields, unicode_to_repr
 </s> add from rest_framework.compat import Mapping, postgres_fields
from rest_framework.compat import Mapping
  import pytest
  from django.db import models
  
  from rest_framework import exceptions, fields, relations, serializers
from rest_framework.compat import Mapping
  from rest_framework.fields import Field
  
  from .models import (
      ForeignKeyTarget, NestedForeignKeySource, NullableForeignKeySource
  )
keep keep keep keep replace keep keep keep keep keep
 Dropped Python 2 compatibility. (#6615)

Thanks to Jon Dufresne (@jdufresne) for review.

Co-authored-by: Asif Saif Uddin <auvipy@gmail.com>
Co-authored-by: Rizwan Mansuri <Rizwan@webbyfox.com> 
tests/test_serializer.py