code: def check(self, user, permission, obj=_nothing):
          
          if not self.allows(user, permission, obj):
              raise AuthorizationError(
                  'Can\'t {} object of class {}'.format(
                      permission, type(obj)))
docs: Raises AuthorizationError when a user has no permission.
  
          :param user: a user.
          :param permission: permission to check.
          :param obj: (optional) an object to check permission for.