  
          if hasattr(token, 'resource'):  # OAuth 1
              return read_only or not request.auth.resource.is_readonly
          elif hasattr(token, 'scope'):  # OAuth 2
              required = oauth2_provider.constants.READ if read_only else oauth2_provider.constants.WRITE
              return oauth2_provider.scope.check(required, request.auth.scope)
  
          assert False, ('TokenHasReadWriteScope requires either the'
          '`OAuthAuthentication` or `OAuth2Authentication` authentication '
          'class to be used.')
 
</s> remove         read_write_access_token.scope = oauth2_provider.scope.SCOPE_NAME_DICT['write']
 </s> add         read_write_access_token.scope = oauth2_provider_scope.SCOPE_NAME_DICT['write'] </s> remove         read_only_access_token.scope = oauth2_provider.scope.SCOPE_NAME_DICT['read']
 </s> add         read_only_access_token.scope = oauth2_provider_scope.SCOPE_NAME_DICT['read'] </s> remove from rest_framework.compat import (get_model_name, oauth2_provider)
 </s> add from rest_framework.compat import (get_model_name, oauth2_provider_scope,
                                   oauth2_constants)
            required = oauth2_constants.READ if read_only else oauth2_constants.WRITE
            return oauth2_provider_scope.check(required, request.auth.scope)
  
          if hasattr(token, 'resource'):  # OAuth 1
              return read_only or not request.auth.resource.is_readonly
          elif hasattr(token, 'scope'):  # OAuth 2
            required = oauth2_constants.READ if read_only else oauth2_constants.WRITE
            return oauth2_provider_scope.check(required, request.auth.scope)
            required = oauth2_constants.READ if read_only else oauth2_constants.WRITE
            return oauth2_provider_scope.check(required, request.auth.scope)
  
          assert False, ('TokenHasReadWriteScope requires either the'
          '`OAuthAuthentication` or `OAuth2Authentication` authentication '
          'class to be used.')
keep keep keep keep replace replace keep keep keep keep
 it's safe to import scope and constants 
rest_framework/permissions.py