              return None
  
          if len(auth) == 1:
              msg = 'Invalid basic header. No credentials provided.'
          if len(auth) > 2:
              msg = 'Invalid basic header. Credentials string should not contain spaces.'
              raise exceptions.AuthenticationFailed(msg)
  
          try:
              auth_parts = base64.b64decode(auth[1]).decode(HTTP_HEADER_ENCODING).partition(':')
 
</s> remove         if len(auth) > 2:
 </s> add             raise exceptions.AuthenticationFailed(msg)
        elif len(auth) > 2: </s> remove         if len(auth) > 2:
 </s> add             raise exceptions.AuthenticationFailed(msg)
        elif len(auth) > 2: </s> remove         if not auth or auth[0].lower() != 'bearer':
 </s> add         if not auth or auth[0].lower() != b'bearer': </s> remove         if not auth or auth[0].lower() != "token":
 </s> add         if not auth or auth[0].lower() != b'token': </s> remove         auth = "Token " + self.key
 </s> add         auth = 'Token ' + self.key
            raise exceptions.AuthenticationFailed(msg)
        elif len(auth) > 2:
              return None
  
          if len(auth) == 1:
              msg = 'Invalid basic header. No credentials provided.'
            raise exceptions.AuthenticationFailed(msg)
        elif len(auth) > 2:
              msg = 'Invalid basic header. Credentials string should not contain spaces.'
              raise exceptions.AuthenticationFailed(msg)
  
          try:
              auth_parts = base64.b64decode(auth[1]).decode(HTTP_HEADER_ENCODING).partition(':')
keep keep keep keep replace keep keep keep keep keep
 Fixes for auth header checking. 
rest_framework/authentication.py