  import binascii
  
  from django.contrib.auth import authenticate, get_user_model
  from django.middleware.csrf import CsrfViewMiddleware
  from django.utils.six import text_type
  from django.utils.translation import ugettext_lazy as _
  
  from rest_framework import HTTP_HEADER_ENCODING, exceptions
  
  
 
</s> remove from __future__ import unicode_literals

 </s> add  </s> remove # coding: utf-8
from __future__ import unicode_literals

 </s> add  </s> remove from rest_framework.compat import unicode_to_repr
 </s> add  </s> remove from __future__ import unicode_literals

 </s> add  </s> remove from django.utils.six.moves.urllib import parse as urlparse
 </s> add 
  import binascii
  
  from django.contrib.auth import authenticate, get_user_model
  from django.middleware.csrf import CsrfViewMiddleware

  from django.utils.translation import ugettext_lazy as _
  
  from rest_framework import HTTP_HEADER_ENCODING, exceptions
  
  
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> 
rest_framework/authentication.py