text: from django.contrib.auth.models import User
  
  class TokenBackend(object):
      def authenticate(self, username=None, password=None):
          try:
              user = User.objects.get(username=username)
          except User.DoesNotExist:
              return None
          return user
  
      def get_user(self, user_id):
          try:
              return User.objects.get(pk=user_id)
          except User.DoesNotExist:
              return None