          api_settings.NON_FIELD_ERRORS_KEY: [detail]
      }
  
  
  @six.add_metaclass(SerializerMetaclass)
  class Serializer(BaseSerializer):
      default_error_messages = {
          'invalid': _('Invalid data. Expected a dictionary, but got {datatype}.')
      }
  
      @property
 
</s> remove                 'Invalid data. Expected a dictionary, but got %s.' % six.text_type.__name__
 </s> add                 'Invalid data. Expected a dictionary, but got str.', </s> remove         text_type_string = six.text_type.__name__
        message = 'Invalid data. Expected a dictionary, but got %s.' % text_type_string
 </s> add         message = 'Invalid data. Expected a dictionary, but got str.' </s> remove         super(EmailField, self).__init__(**kwargs)
 </s> add         super().__init__(**kwargs) </s> remove       - { python: "2.7", env: TOXENV=lint }
      - { python: "2.7", env: TOXENV=docs }
 </s> add       - { python: "3.7", env: TOXENV=lint }
      - { python: "3.7", env: TOXENV=docs } </s> remove       - { python: "2.7", env: DJANGO=1.11 }
 </s> add 
class Serializer(BaseSerializer, metaclass=SerializerMetaclass):
          api_settings.NON_FIELD_ERRORS_KEY: [detail]
      }
  
  
class Serializer(BaseSerializer, metaclass=SerializerMetaclass):
class Serializer(BaseSerializer, metaclass=SerializerMetaclass):
      default_error_messages = {
          'invalid': _('Invalid data. Expected a dictionary, but got {datatype}.')
      }
  
      @property
keep keep keep keep replace 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> 
rest_framework/serializers.py