      from provider.oauth2 import backends as oauth2_provider_backends
      from provider.oauth2 import models as oauth2_provider_models
      from provider.oauth2 import forms as oauth2_provider_forms
  
  except ImportError:
      oauth2_provider = None
      oauth2_provider_backends = None
 
</s> remove from rest_framework.compat import oauth2_provider, oauth2_provider_models
 </s> add from rest_framework.compat import oauth2_provider, oauth2_provider_models, oauth2_provider_scope
    from provider import scope as oauth2_provider_scope
      from provider.oauth2 import backends as oauth2_provider_backends
      from provider.oauth2 import models as oauth2_provider_models
      from provider.oauth2 import forms as oauth2_provider_forms
    from provider import scope as oauth2_provider_scope
  
  except ImportError:
      oauth2_provider = None
      oauth2_provider_backends = None
keep keep add keep keep keep keep
 Add TokenHasReadWriteScope class for permissions based on scopes 
rest_framework/compat.py