  from django.utils import six
  from django.utils.timezone import pytz, utc
  
  import rest_framework
  from rest_framework import serializers
  from rest_framework.fields import is_simple_callable
  
  try:
      import typings
  except ImportError:
 
</s> remove from django.utils.timezone import pytz, utc
 </s> add from django.utils.timezone import utc </s> remove     get_remote_field, unicode_repr, unicode_to_repr, value_from_object
 </s> add     InvalidTimeError, get_remote_field, unicode_repr, unicode_to_repr,
    value_from_object </s> remove             except Exception:
 </s> add             except InvalidTimeError: </s> remove     field = serializers.DateTimeField(default_timezone=pytz.timezone('America/New_York'))
 </s> add     class MockTimezone:
        @staticmethod
        def localize(value, is_dst):
            raise compat.InvalidTimeError()

        def __str__(self):
            return 'America/New_York'

    field = serializers.DateTimeField(default_timezone=MockTimezone())
from rest_framework import compat, serializers
  from django.utils import six
  from django.utils.timezone import pytz, utc
  
  import rest_framework
from rest_framework import compat, serializers
  from rest_framework.fields import is_simple_callable
  
  try:
      import typings
  except ImportError:
keep keep keep keep replace keep keep keep keep keep
 Added pytz exception in compat module.
Mock pytz.timezone localize in tests.
Ref: #4986 
tests/test_fields.py