  # OAuth 2 support is optional
  try:
      import provider as oauth2_provider
      if oauth2_provider.__version__ in ('0.2.3', '0.2.4'):
          # 0.2.3 and 0.2.4 are supported version that do not support
          # timezone aware datetimes
          import datetime
          provider_now = datetime.datetime.now
 
</s> remove             required = oauth2_provider.constants.READ if read_only else oauth2_provider.constants.WRITE
            return oauth2_provider.scope.check(required, request.auth.scope)
 </s> add             required = oauth2_constants.READ if read_only else oauth2_constants.WRITE
            return oauth2_provider_scope.check(required, request.auth.scope) </s> remove from rest_framework.compat import oauth2_provider
 </s> add from rest_framework.compat import oauth2_provider, oauth2_provider_scope </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) </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']
    from provider import scope as oauth2_provider_scope
    from provider import constants as oauth2_constants
  # OAuth 2 support is optional
  try:
      import provider as oauth2_provider
    from provider import scope as oauth2_provider_scope
    from provider import constants as oauth2_constants
      if oauth2_provider.__version__ in ('0.2.3', '0.2.4'):
          # 0.2.3 and 0.2.4 are supported version that do not support
          # timezone aware datetimes
          import datetime
          provider_now = datetime.datetime.now
keep keep add keep keep keep keep keep
 it's safe to import scope and constants 
rest_framework/compat.py