code: def has_perm(self, user_obj, perm, obj=None):
          
          if perm not in self.get_supported_permissions():
              return False
          # use cache to reduce method call
          CACHE_NAME = '_logical_perms_cache'
          if not hasattr(user_obj, CACHE_NAME):
              setattr(user_obj, CACHE_NAME, {})
          cache = getattr(user_obj, CACHE_NAME)
          cachekey = "%s %s" % (perm, hash(obj))
          if cachekey not in cache:
              cache[cachekey] = self._has_perm(user_obj, perm, obj)
          return cache[cachekey]
docs: Check if user have permission (of object) based on
          specified models's ``_permission_logics`` attribute.
  
          The result will be stored in user_obj as a cache to reduce method call.
  
          Parameters
          ----------
          user_obj : django user model instance
              A django user model instance which be checked
          perm : string
              `app_label.codename` formatted permission string
          obj : None or django model instance
              None or django model instance for object permission
  
          Returns
          -------
          boolean
              Whether the specified user have specified permission (of specified
              object).