code: def is_resource_protected(self, request, **kwargs):
          
          exempt_urls = self.get_exempt_url_patterns()
          protected_urls = self.get_protected_url_patterns()
          path = request.path_info.lstrip('/')
  
          path_is_exempt = any(m.match(path) for m in exempt_urls)
          if path_is_exempt:
              return False
  
          path_is_protected = any(m.match(path) for m in protected_urls)
          if path_is_protected:
              return True
  
          return False
docs: Returns true if and only if the resource's URL is *not* exempt and *is* protected.