code: def get_permissions(self, user, obj=_nothing):
          
          rule = self._get_rule(obj)
  
          all_permissions = (
              attr[len('can_'):] for attr in dir(rule)
              if attr.startswith('can_')
          )
  
          return set(
              permission for permission in all_permissions
              if self.allows(user, permission, obj)
          )
docs: Returns permissions of a user.
  
          :param user: a user.
          :param obj: (optional) an object to get permissions for.